summaryrefslogtreecommitdiff
path: root/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_FurLighting.cginc345
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_FurLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiAlphaToCoverage.cginc29
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiAlphaToCoverage.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBackFace.cginc29
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBackFace.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlackLight.cginc53
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlackLight.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlending.cginc37
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlending.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBulge.cginc38
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBulge.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiClearCoat.cginc108
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiClearCoat.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiColors.cginc180
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiColors.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiData.cginc188
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiData.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDebug.cginc102
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDebug.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDecal.cginc45
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDecal.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDefines.cginc21
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDefines.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDepthColor.cginc43
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDepthColor.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDissolve.cginc216
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDissolve.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDithering.cginc34
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDithering.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEmission.cginc198
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEmission.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEnvironmentalRimLighting.cginc43
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFlipbook.cginc155
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFlipbook.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFrag.cginc360
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFur.cginc40
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFur.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFurCardPass.cginc200
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFurCardPass.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeom.cginc10
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeom.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeomFur.cginc37
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeomFur.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGlitter.cginc229
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGlitter.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGrab.cginc109
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGrab.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHelpers.cginc294
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHelpers.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHologram.cginc36
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHologram.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiIridescence.cginc61
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiIridescence.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiLighting.cginc409
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMSDF.cginc235
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMSDF.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMacros.cginc29
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMacros.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMainTex.cginc159
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMainTex.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMatcap.cginc105
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMatcap.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMath.cginc78
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMath.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMetal.cginc126
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMetal.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMirror.cginc77
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMirror.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineFrag.cginc76
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineVert.cginc90
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPanosphere.cginc70
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPanosphere.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiParallax.cginc142
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiParallax.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPass.cginc263
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPass.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassOutline.cginc26
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassOutline.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassShadow.cginc31
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassShadow.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRGBMask.cginc51
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRGBMask.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRNG.cginc4
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRNG.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRandom.cginc39
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRandom.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRimLighting.cginc53
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRimLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowFrag.cginc95
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowIncludes.cginc41
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowIncludes.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowVert.cginc73
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInFrag.cginc54
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInVert.cginc40
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpecular.cginc478
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpecular.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSubsurfaceScattering.cginc28
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSubsurfaceScattering.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiTessellation.cginc117
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiTessellation.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiUVDistortion.cginc22
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiUVDistortion.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiV2F.cginc34
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiV2F.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVert.cginc107
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVertexManipulations.cginc97
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVertexManipulations.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVideo.cginc267
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVideo.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVoronoi.cginc294
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVoronoi.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiWireframe.cginc111
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiWireframe.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_Poicludes.cginc176
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_Poicludes.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/Notes.txt7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/Notes.txt.meta7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/DepthGet.prefab71
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/DepthGet.prefab.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX/PoiyomiEyeFX.shader163
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX/PoiyomiEyeFX.shader.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_FunctionsArtistic.cginc369
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_FunctionsArtistic.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAlphaToCoverage.cginc32
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAlphaToCoverage.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAudioLink.cginc128
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAudioLink.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBRDF.cginc253
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBRDF.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBackFace.cginc49
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBackFace.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlackLight.cginc56
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlackLight.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlending.cginc385
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlending.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBulge.cginc41
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBulge.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiClearCoat.cginc327
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiClearCoat.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiData.cginc265
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiData.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDebug.cginc107
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDebug.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDecal.cginc331
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDecal.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDefines.cginc22
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDefines.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDepthColor.cginc129
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDepthColor.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDissolve.cginc237
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDissolve.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDithering.cginc34
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDithering.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEmission.cginc341
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEmission.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc48
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFlipbook.cginc221
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFlipbook.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFrag.cginc422
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFur.cginc41
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFur.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGeomFur.cginc37
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGeomFur.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGlitter.cginc274
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGlitter.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGrab.cginc125
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGrab.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHelpers.cginc336
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHelpers.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHologram.cginc44
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHologram.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiIridescence.cginc104
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiIridescence.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiLighting.cginc981
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMSDF.cginc243
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMSDF.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMacros.cginc40
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMacros.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMainTex.cginc193
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMainTex.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMatcap.cginc160
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMatcap.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMath.cginc100
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMath.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMetal.cginc130
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMetal.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMirror.cginc81
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMirror.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineFrag.cginc117
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineVert.cginc144
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPanosphere.cginc80
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPanosphere.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiParallax.cginc166
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiParallax.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPass.cginc252
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPass.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassOutline.cginc34
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassOutline.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassShadow.cginc46
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassShadow.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPathing.cginc150
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPathing.cginc.meta9
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPenetration.cginc0
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPenetration.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRGBMask.cginc191
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRGBMask.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRandom.cginc41
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRandom.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRimLighting.cginc99
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRimLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowFrag.cginc143
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowIncludes.cginc44
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowIncludes.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowVert.cginc86
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInFrag.cginc58
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInVert.cginc40
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpecular.cginc505
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpecular.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc75
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiTessellation.cginc117
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiTessellation.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiUVDistortion.cginc74
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiUVDistortion.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiV2F.cginc35
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiV2F.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVert.cginc145
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVertexManipulations.cginc102
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVertexManipulations.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVideo.cginc297
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVideo.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVoronoi.cginc312
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVoronoi.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiWireframe.cginc111
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiWireframe.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_Poicludes.cginc179
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_Poicludes.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/Notes.txt7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/Notes.txt.meta7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders/S_Poiyomi_Pro.shader2024
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders/S_Poiyomi_Pro.shader.meta111
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiClearCoat.cginc78
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiClearCoat.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiData.cginc104
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiData.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDebug.cginc123
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDebug.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDissolve.cginc200
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDissolve.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDragNDropLighting.cginc100
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDragNDropLighting.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiEmission.cginc74
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiEmission.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFlipbook.cginc70
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFlipbook.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFrag.cginc196
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFrag.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiGeom.cginc10
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiGeom.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiHelpers.cginc166
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiHelpers.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiLighting.cginc130
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiLighting.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMainTex.cginc111
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMainTex.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMatcap.cginc82
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMatcap.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMetal.cginc82
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMetal.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMirror.cginc77
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMirror.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineFrag.cginc55
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineFrag.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineVert.cginc72
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineVert.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPanosphere.cginc55
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPanosphere.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParallax.cginc121
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParallax.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParticlePass.cginc343
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParticlePass.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPass.cginc124
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPass.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassOutline.cginc15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassOutline.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassShadow.cginc17
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassShadow.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRandom.cginc39
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRandom.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRefraction.cginc50
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRefraction.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRimLighting.cginc95
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRimLighting.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowFrag.cginc44
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowFrag.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowIncludes.cginc33
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowIncludes.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowVert.cginc18
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowVert.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSpecular.cginc207
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSpecular.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSubsurfaceScattering.cginc35
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSubsurfaceScattering.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiTouch.cginc33
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiTouch.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiVert.cginc63
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiVert.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/Poicludes.cginc147
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/Poicludes.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonCutout.shader667
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonCutout.shader.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonTransparent.shader671
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonTransparent.shader.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonCutout.shader596
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonCutout.shader.meta27
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonTransparent.shader601
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonTransparent.shader.meta27
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 1.mat245
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 1.mat.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 2.mat245
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 2.mat.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial.mat247
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial.mat.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagPrefab.prefab84
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagPrefab.prefab.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/PoiyomiNameTag.shader179
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/PoiyomiNameTag.shader.meta8
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/Ring (1).fbxbin0 -> 15132 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/Ring (1).fbx.meta91
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/YourName.pngbin0 -> 13698 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/YourName.png.meta76
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/poiyomi.pngbin0 -> 8466 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/poiyomi.png.meta99
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPC.shader1244
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPC.shader.meta84
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPCO.shader1325
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPCO.shader.meta86
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Transparent_PPT.shader1245
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Transparent_PPT.shader.meta84
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeCutout_PPC.shader1243
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeCutout_PPC.shader.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT.shader1244
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT.shader.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_label602
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_label.meta7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_locale.csv1205
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_locale.csv.meta7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/PoiShatterHelpers.cginc20
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/PoiShatterHelpers.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/Shatter.mat220
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/Shatter.mat.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterPass.cginc517
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterPass.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterWave2.shader264
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterWave2.shader.meta22
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Test.unity528
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Test.unity.meta7
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy 1.pngbin0 -> 9965 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy 1.png.meta99
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy.pngbin0 -> 7515 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy.png.meta99
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures.meta8
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/GameboyRamp.pngbin0 -> 6026 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/GameboyRamp.png.meta86
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_CRT.pngbin0 -> 9338 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_CRT.png.meta99
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_IPS.pngbin0 -> 133998 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_IPS.png.meta99
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_LCD.pngbin0 -> 4733 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_LCD.png.meta99
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_OLED.pngbin0 -> 5871 bytes
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_OLED.png.meta99
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiBasics.cginc60
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiBasics.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiData.cginc18
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiData.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDefaultPass.cginc20
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDefaultPass.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDragNDropLighting.cginc100
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDragNDropLighting.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiEmission.cginc52
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiEmission.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFrag.cginc159
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFrag.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFun.cginc62
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFun.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiGeom.cginc240
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiGeom.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiHelpers.cginc42
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiHelpers.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiLighting.cginc124
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiLighting.cginc.meta8
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMacros.cginc0
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMacros.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMatcap.cginc36
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMatcap.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMetal.cginc77
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMetal.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineFrag.cginc26
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineFrag.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineIncludes.cginc46
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineIncludes.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineVert.cginc28
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineVert.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPanosphere.cginc41
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPanosphere.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPass.cginc28
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPass.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassOutline.cginc18
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassOutline.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassShadow.cginc14
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassShadow.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRefraction.cginc49
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRefraction.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRimLighting.cginc39
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRimLighting.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiScrollingLayers.cginc23
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiScrollingLayers.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowFrag.cginc29
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowFrag.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowIncludes.cginc29
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowIncludes.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowVert.cginc11
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowVert.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSpecular.cginc173
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSpecular.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSubsurfaceScattering.cginc30
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSubsurfaceScattering.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiTextureBlending.cginc33
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiTextureBlending.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiVert.cginc32
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiVert.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/Poicludes.cginc46
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/Poicludes.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/Cubed.mat831
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/Cubed.mat.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/PoiyomiCubed.shader259
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/PoiyomiCubed.shader.meta27
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_FunctionsArtistic.cginc369
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_FunctionsArtistic.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAlphaToCoverage.cginc32
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAlphaToCoverage.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAudioLink.cginc128
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAudioLink.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBRDF.cginc254
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBRDF.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBackFace.cginc49
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBackFace.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlackLight.cginc56
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlackLight.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlending.cginc385
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlending.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBulge.cginc41
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBulge.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiClearCoat.cginc213
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiClearCoat.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiData.cginc260
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiData.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDebug.cginc107
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDebug.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDecal.cginc331
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDecal.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDefines.cginc7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDefines.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDepthColor.cginc129
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDepthColor.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDissolve.cginc237
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDissolve.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDithering.cginc34
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDithering.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEmission.cginc341
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEmission.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc48
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFlipbook.cginc221
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFlipbook.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFrag.cginc422
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGlitter.cginc274
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGlitter.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGrab.cginc125
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGrab.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHelpers.cginc336
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHelpers.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHologram.cginc44
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHologram.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiIridescence.cginc104
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiIridescence.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiLighting.cginc962
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMSDF.cginc243
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMSDF.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMacros.cginc40
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMacros.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMainTex.cginc192
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMainTex.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMatcap.cginc160
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMatcap.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMath.cginc100
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMath.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMetal.cginc130
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMetal.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMirror.cginc81
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMirror.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineFrag.cginc117
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineVert.cginc144
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPanosphere.cginc80
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPanosphere.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiParallax.cginc166
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiParallax.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPass.cginc252
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPass.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassOutline.cginc34
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassOutline.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassShadow.cginc46
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassShadow.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPathing.cginc150
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPathing.cginc.meta9
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPenetration.cginc0
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPenetration.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRGBMask.cginc191
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRGBMask.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRandom.cginc41
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRandom.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRimLighting.cginc99
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRimLighting.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowFrag.cginc143
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowIncludes.cginc44
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowIncludes.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowVert.cginc86
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInFrag.cginc58
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInFrag.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInVert.cginc40
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpecular.cginc505
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpecular.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc75
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiTessellation.cginc117
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiTessellation.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiUVDistortion.cginc74
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiUVDistortion.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiV2F.cginc35
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiV2F.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVert.cginc145
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVert.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVertexManipulations.cginc102
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVertexManipulations.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVideo.cginc297
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVideo.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVoronoi.cginc312
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVoronoi.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiWireframe.cginc111
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiWireframe.cginc.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_Poicludes.cginc172
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_Poicludes.cginc.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/Notes.txt7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/Notes.txt.meta7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/7PlusLabels.txt233
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/7PlusLabels.txt.meta7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/PatchNotes.poi21
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/PatchNotes.poi.meta7
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro.shader1996
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro.shader.meta111
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro_GrabPass.shader2021
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro_GrabPass.shader.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Toon.shader1838
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Toon.shader.meta103
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Early Outline.shader27986
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Early Outline.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Outline.shader27986
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Outline.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi World.shader28694
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi World.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi.shader22881
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi.shader.meta15
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1.meta8
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Outline.shader29494
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Outline.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Z.shader24601
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Z.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Grab Pass.shader24437
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Grab Pass.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Outline.shader29494
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Outline.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro World.shader30357
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro World.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro.shader24102
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi.shader22990
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi.shader.meta15
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/InvisStencil.shader72
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/InvisStencil.shader.meta9
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/MasterScanner.shader62
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/MasterScanner.shader.meta8
-rw-r--r--VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/PoiLabels.txt298
-rwxr-xr-xVRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/PoiLabels.txt.meta7
647 files changed, 353148 insertions, 0 deletions
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders.meta
new file mode 100755
index 00000000..8f961311
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b3c5b5f9182fdc74ab4dbddc58f0c1fe
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3.meta
new file mode 100644
index 00000000..fa43e060
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 4b471117f0fd79b4e9d4b06859258287
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes.meta
new file mode 100644
index 00000000..f9e8bb14
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9077f2b3e65e92645966ea3e37a8b837
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_FurLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_FurLighting.cginc
new file mode 100644
index 00000000..c5f2dd06
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_FurLighting.cginc
@@ -0,0 +1,345 @@
+
+#ifndef POI_LIGHTING
+ #define POI_LIGHTING
+
+ int _LightingType;
+ float _AdditiveSoftness;
+ float _AdditiveOffset;
+ float _ForceLightDirection;
+ float _ShadowStrength;
+ float _OutlineShadowStrength;
+ float _ShadowOffset;
+ float3 _LightDirection;
+ float _ForceShadowStrength;
+ float _CastedShadowSmoothing;
+ float _LightingIndirectContribution;
+ float _AttenuationMultiplier;
+ float _EnableLighting;
+ float _LightingControlledUseLightColor;
+ uint _LightingAOTexUV;
+ fixed _LightingStandardSmoothness;
+ fixed _LightingStandardControlsToon;
+ fixed _LightingMinLightBrightness;
+ fixed _LightingAdditiveIntensity;
+ fixed _AoIndirectStrength;
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+
+ sampler2D _LightingAOTex; float4 _LightingAOTex_ST;
+ sampler2D _LightingShadowMask; float4 _LightingShadowMask_ST;
+ float _AOStrength;
+
+ float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax)
+ {
+ #if UNITY_SPECCUBE_BOX_PROJECTION
+ UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax: boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition);
+ }
+ #endif
+ return direction;
+ }
+
+ /*
+ * Standard stuff Start
+ */
+ UnityLight CreateLight(half3 lightDirection, half attenuation, half ndotl)
+ {
+ UnityLight light;
+ light.dir = lightDirection;
+ light.color = saturate(_LightColor0.rgb * lerp(1, attenuation, _AttenuationMultiplier));
+ light.ndotl = ndotl;
+ return light;
+ }
+
+ float FadeShadows(float attenuation)
+ {
+ #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 = lerp(1, attenuation, _AttenuationMultiplier);
+ #endif
+
+ float viewZ = dot(_WorldSpaceCameraPos - worldPos, UNITY_MATRIX_V[2].xyz);
+ float shadowFadeDistance = UnityComputeShadowFadeDistance(worldPos, viewZ);
+ float shadowFade = UnityComputeShadowFade(shadowFadeDistance);
+ float bakedAttenuation = UnitySampleBakedOcclusion(lightmapUV.xy, worldPos);
+ attenuation = UnityMixRealtimeAndBakedShadows(
+ attenuation, bakedAttenuation, shadowFade
+ );
+ #endif
+
+ return attenuation;
+ }
+
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ attenuation = FadeShadows(lerp(1, attenuation, _AttenuationMultiplier));
+
+ float nDotL = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = nDotL * (1 - attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ indirectLight.diffuse = min(subtractedLight, indirectLight.diffuse);
+ #endif
+ }
+
+ UnityIndirect CreateIndirectLight(float3 normal, float3 worldPos, half3 viewDir, float2 uv)
+ {
+ UnityIndirect indirectLight;
+ indirectLight.diffuse = 0;
+ indirectLight.specular = 0;
+
+ #if defined(FORWARD_BASE_PASS)
+ #if defined(LIGHTMAP_ON)
+ indirectLight.diffuse = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, lightmapUV.xy));
+
+ #if defined(DIRLIGHTMAP_COMBINED)
+ float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(
+ unity_LightmapInd, unity_Lightmap, lightmapUV.xy
+ );
+ indirectLight.diffuse = DecodeDirectionalLightmap(
+ indirectLight.diffuse, lightmapDirection, normal
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #endif
+
+ #if defined(DYNAMICLIGHTMAP_ON)
+ float3 dynamicLightDiffuse = DecodeRealtimeLightmap(
+ UNITY_SAMPLE_TEX2D(unity_DynamicLightmap, lightmapUV.zw)
+ );
+
+ #if defined(DIRLIGHTMAP_COMBINED)
+ float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(
+ unity_DynamicDirectionality, unity_DynamicLightmap,
+ lightmapUV.zw
+ );
+ indirectLight.diffuse += DecodeDirectionalLightmap(
+ dynamicLightDiffuse, dynamicLightmapDirection, normal
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(normal, 1), worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1)));
+ #endif
+ #endif
+
+ float3 reflectionDir = reflect(-viewDir, normal);
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = 1 - _LightingStandardSmoothness;
+ envData.reflUVW = BoxProjection(
+ reflectionDir, worldPos.xyz,
+ unity_SpecCube0_ProbePosition,
+ unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax
+ );
+ float3 probe0 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData
+ );
+ envData.reflUVW = BoxProjection(
+ reflectionDir, worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax
+ );
+ #if UNITY_SPECCUBE_BLENDING
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ float3 probe1 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0),
+ unity_SpecCube0_HDR, envData
+ );
+ indirectLight.specular = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ indirectLight.specular = probe0;
+ }
+ #else
+ indirectLight.specular = probe0;
+ #endif
+
+ float occlusion = lerp(1, tex2D(_LightingAOTex, TRANSFORM_TEX(uv, _LightingAOTex)), _AOStrength);
+
+ indirectLight.diffuse *= occlusion;
+ indirectLight.diffuse = max(indirectLight.diffuse, _LightingMinLightBrightness);
+ indirectLight.specular *= occlusion;
+ #endif
+
+ return indirectLight;
+ }
+
+ /*
+ * Standard stuff End
+ */
+
+ half PoiDiffuse(half NdotV, half nDotL, half LdotH)
+ {
+ half fd90 = 0.5 + 2 * LdotH * LdotH * SmoothnessToPerceptualRoughness(.5);
+ // Two schlick fresnel term
+ half lightScatter = (1 + (fd90 - 1) * Pow5(1 - nDotL));
+ half viewScatter = (1 + (fd90 - 1) * Pow5(1 - NdotV));
+
+ return lightScatter * viewScatter;
+ }
+
+ float3 ShadeSH9Indirect()
+ {
+ return ShadeSH9(half4(0.0, -1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Direct()
+ {
+ return ShadeSH9(half4(0.0, 1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Normal(float3 normalDirection)
+ {
+ return ShadeSH9(half4(normalDirection, 1.0));
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ x1.b = length(unity_SHBb);
+ return x + x1;
+ }
+
+ float3 calculateRealisticLighting(float4 colorToLight, float3 normal, float3 viewDir, half3 lightDirection, half attenuation, half ndotl, float3 worldPos, float2 uv)
+ {
+ return UNITY_BRDF_PBS(colorToLight, 0, 0, _LightingStandardSmoothness,
+ normal, viewDir, CreateLight(lightDirection, attenuation, ndotl), CreateIndirectLight(normal, worldPos, viewDir, uv));
+ }
+
+ half3 calculateBasePassLighting(float2 uv, float3 lightColor, half nDotL, half attenuation, half3 normal, half3 viewDir, half3 lightDirection, float3 worldPos)
+ {
+ half3 finalLighting = 0;
+ UNITY_BRANCH
+ if (_LightingType == 0 || _LightingType == 1)
+ {
+ float AOMap = 1;
+ float DirectAO = 1;
+ float IndirectAO = 1;
+ #ifndef OUTLINE
+ AOMap = tex2D(_LightingAOTex, TRANSFORM_TEX(uv, _LightingAOTex));
+ DirectAO = lerp(1, AOMap, _AOStrength);
+ IndirectAO = lerp(1, AOMap, _AoIndirectStrength);
+ #endif
+
+ half3 grayscale_vector = float3(.33333, .33333, .33333);
+ half3 ShadeSH9Plus = GetSHLength();
+ half3 ShadeSH9Minus = ShadeSH9(float4(0, 0, 0, 1));
+ half3 directLighting = saturate(lerp(ShadeSH9Plus, lightColor, 1 - _LightingIndirectContribution));
+ half3 indirectLighting = saturate(ShadeSH9Minus) * IndirectAO;
+
+ half4 shadowStrength = 1;
+ #ifndef OUTLINE
+ shadowStrength = tex2D(_LightingShadowMask, TRANSFORM_TEX(uv, _LightingShadowMask));
+ shadowStrength *= _ShadowStrength;
+ #else
+ shadowStrength = _OutlineShadowStrength;
+ #endif
+
+ float bw_lightColor = dot(lightColor, grayscale_vector);
+ float bw_directLighting = (((nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, attenuation, _AttenuationMultiplier)) + dot(ShadeSH9Normal(normal), grayscale_vector));
+ float bw_bottomIndirectLighting = dot(ShadeSH9Minus, grayscale_vector);
+ float bw_topIndirectLighting = dot(ShadeSH9Plus, grayscale_vector);
+ float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting);
+ float lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting) * DirectAO;
+ float3 rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, lightMap + _ShadowOffset), shadowStrength.r);
+
+ UNITY_BRANCH
+ if(_LightingType == 0)
+ {
+ finalLighting = lerp(indirectLighting, directLighting, rampedLightMap);
+ }
+ UNITY_BRANCH
+ if(_LightingType == 1)
+ {
+ finalLighting = rampedLightMap * directLighting;
+ }
+ }
+ return finalLighting;
+ }
+
+ void applyFurLighting(inout float4 finalColor, float2 uv, half attenuation, half3 normal, half3 viewDir, float3 worldPos)
+ {
+ float3 finalLighting = 0;
+ float3 lightColor = 0;
+ float3 lightDirection = 0;
+
+ #ifdef FORWARD_BASE_PASS
+ //lightColor = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 magic = saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 normalLight = saturate(_LightColor0.rgb);
+ lightColor = saturate(magic + normalLight);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ lightColor = _LightColor0.rgb;
+ #endif
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ lightDirection = normalize(_WorldSpaceLightPos0.xyz - i.worldPos);
+ #endif
+ #endif
+
+ half nDotL = dot(normal, lightDirection);
+
+ #ifdef FORWARD_BASE_PASS
+ finalLighting = calculateBasePassLighting(uv, lightColor, nDotL, attenuation, normal, viewDir, lightDirection, worldPos);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ finalLighting = lightColor * attenuation * smoothstep(.5 - _AdditiveSoftness + _AdditiveOffset, .5 + _AdditiveSoftness + _AdditiveOffset, .5 * nDotL + .5);
+ finalLighting *= _LightingAdditiveIntensity;
+ #endif
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if (_LightingType == 2)
+ {
+ finalColor.rgb = calculateRealisticLighting(finalColor, normal, viewDir, lightDirection, attenuation, nDotL, worldPos, uv);
+ }
+ else
+ {
+ finalColor.rgb *= max(finalLighting, _LightingMinLightBrightness);
+ }
+ #else
+ finalColor.rgb *= max(finalLighting, _LightingMinLightBrightness);
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_FurLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_FurLighting.cginc.meta
new file mode 100644
index 00000000..5e047b15
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_FurLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7a386c7b6529ea741a7b4b91edd52894
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiAlphaToCoverage.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiAlphaToCoverage.cginc
new file mode 100644
index 00000000..ac378228
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiAlphaToCoverage.cginc
@@ -0,0 +1,29 @@
+#ifndef POI_ALPHA_TO_COVERAGE
+ #define POI_ALPHA_TO_COVERAGE
+
+ half _MainMipScale;
+ float _MainAlphaToCoverage;
+
+ 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);
+ }
+
+ void ApplyAlphaToCoverage(inout float4 finalColor)
+ {
+ // Force Model Opacity to 1 if desired
+
+ UNITY_BRANCH
+ if (_MainAlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ finalColor.a *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _MainMipScale;
+ // rescale alpha by partial derivative
+ finalColor.a = (finalColor.a - _Clip) / max(fwidth(finalColor.a), 0.0001) + _Clip;
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiAlphaToCoverage.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiAlphaToCoverage.cginc.meta
new file mode 100644
index 00000000..058d9cc3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiAlphaToCoverage.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6748073008081154589fb6cc65f5fa4f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBackFace.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBackFace.cginc
new file mode 100644
index 00000000..3744bda4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBackFace.cginc
@@ -0,0 +1,29 @@
+#ifndef POI_BACKFACE
+ #define POI_BACKFACE
+
+ float _BackFaceEnabled;
+ uint _BackFaceTextureUV;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float _BackFaceHueShift;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_BackFaceTexture); float4 _BackFaceTexture_ST;
+
+ float3 BackFaceColor;
+ void applyBackFaceTexture()
+ {
+ BackFaceColor = 0;
+ UNITY_BRANCH
+ if (_BackFaceEnabled)
+ {
+ if(!poiMesh.isFrontFace)
+ {
+ albedo = POI2D_SAMPLER_PAN(_BackFaceTexture, _MainTex, poiMesh.uv[_BackFaceTextureUV], _BackFacePanning);
+ _DetailTexIntensity = _BackFaceDetailIntensity;
+ BackFaceColor = albedo.rgb;
+ _MainHueShift = _BackFaceHueShift;
+ }
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBackFace.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBackFace.cginc.meta
new file mode 100644
index 00000000..a13087e7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBackFace.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4f4a418d4b464c64ca33221f2e6e8cbb
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlackLight.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlackLight.cginc
new file mode 100644
index 00000000..db553208
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlackLight.cginc
@@ -0,0 +1,53 @@
+#ifndef POI_BLACKLIGHT
+ #define POI_BLACKLIGHT
+
+ float4 _BlackLightMaskStart;
+ float4 _BlackLightMaskEnd;
+ float4 _BlackLightMaskKeys;
+ float _BlackLightMaskDebug;
+ uint _BlackLightMaskDissolve;
+ uint _BlackLightMaskMetallic;
+ uint _BlackLightMaskClearCoat;
+ uint _BlackLightMaskMatcap;
+ uint _BlackLightMaskMatcap2;
+ uint _BlackLightMaskEmission;
+ uint _BlackLightMaskEmission2;
+ uint _BlackLightMaskFlipbook;
+ uint _BlackLightMaskPanosphere;
+ uint _BlackLightMaskIridescence;
+
+ half _BlackLightMaskGlitter;
+
+ half4 blackLightMask;
+
+ void createBlackLightMask()
+ {
+ blackLightMask = 0;
+ #ifdef VERTEXLIGHT_ON
+
+ for (int lightIndex = 0; lightIndex < 4; lightIndex ++)
+ {
+ float3 lightPos = float3(unity_4LightPosX0[lightIndex], unity_4LightPosY0[lightIndex], unity_4LightPosZ0[lightIndex]);
+ if (!distance(unity_LightColor[lightIndex].rgb, float3(0, 0, 0)))
+ {
+ for (int maskIndex = 0; maskIndex < 4; maskIndex ++)
+ {
+ if(unity_LightColor[lightIndex].a == _BlackLightMaskKeys[maskIndex])
+ {
+ blackLightMask[maskIndex] = max(blackLightMask[maskIndex], smoothstep(_BlackLightMaskEnd[maskIndex], _BlackLightMaskStart[maskIndex], distance(poiMesh.worldPos, lightPos)));
+ }
+ }
+ }
+ }
+ #endif
+ }
+#endif
+
+/*
+#ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ blackLightMask[mask];
+ }
+#endif
+*/ \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlackLight.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlackLight.cginc.meta
new file mode 100644
index 00000000..ec1be4e2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlackLight.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b026a041cbf89ab41885a9800b6fae01
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlending.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlending.cginc
new file mode 100644
index 00000000..c6457025
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlending.cginc
@@ -0,0 +1,37 @@
+#ifndef POI_BLENDING
+ #define POI_BLENDING
+
+ /*
+ 0: Zero float4(0.0, 0.0, 0.0, 0.0),
+ 1: One float4(1.0, 1.0, 1.0, 1.0),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 9: SrcAlphaSaturate saturate(sourceColor.aaaa),
+ 10: OneMinusSrcAlpha float4(1.0, 1.0, 1.0, 1.0) - sourceColor.aaaa,
+ */
+
+ float4 poiBlend(const uint sourceFactor, const float4 sourceColor, const uint destinationFactor, const float4 destinationColor)
+ {
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sourceColor.aaaa,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ destinationColor.aaaa,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor.aaaa,
+ saturate(sourceColor.aaaa),
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor.aaaa,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor,sourceColor, sourceColor.a);
+ }
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlending.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlending.cginc.meta
new file mode 100644
index 00000000..7a36482e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBlending.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4b77204a0028f804a873d6c111a13453
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBulge.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBulge.cginc
new file mode 100644
index 00000000..21f0c00c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBulge.cginc
@@ -0,0 +1,38 @@
+#ifndef POI_BULGE
+ #define POI_BULGE
+
+ #ifndef POI_CAMERA_DEPTH
+ #define POI_CAMERA_DEPTH
+ sampler2D _CameraDepthTexture;
+ #endif
+
+ sampler2D _BulgeMask;
+ float _BuldgeFadeLength;
+ float _BuldgeHeight;
+
+ void bulgyWolgy(inout v2f o)
+ {
+ float depth = DecodeFloatRG(tex2Dlod(_CameraDepthTexture, float4(o.grabPos.xy / o.grabPos.w, 0, 0)));
+ float bulgeMask = tex2Dlod(_BulgeMask, float4(o.uv0.xy, 0, 0));
+ depth = Linear01Depth(depth);
+
+ float intersect = 0;
+ if (depth != 1)
+ {
+ float diff = distance(depth, Linear01Depth(o.pos.z / o.pos.w));
+ if(diff > 0)
+ {
+ intersect = 1 - smoothstep(0, _ProjectionParams.w * _BuldgeFadeLength, diff);
+ }
+ }
+ float4 offset = intersect * _BuldgeHeight * float4(o.normal, 0);
+
+ offset = IsInMirror() ? 0: offset;
+ offset *= bulgeMask;
+
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos) + offset;
+ o.localPos = mul(unity_WorldToObject, o.worldPos);
+ o.pos = UnityObjectToClipPos(o.localPos);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBulge.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBulge.cginc.meta
new file mode 100644
index 00000000..aecc98bd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiBulge.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 375d769e3421a0c46a1c07b480cb90ce
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiClearCoat.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiClearCoat.cginc
new file mode 100644
index 00000000..aef58a06
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiClearCoat.cginc
@@ -0,0 +1,108 @@
+#ifndef POI_CLEARCOAT
+ #define POI_CLEARCOAT
+
+ samplerCUBE _ClearCoatCubeMap;
+ float _ClearCoatSampleWorld;
+ POI_TEXTURE_NOSAMPLER(_ClearCoatMask);
+ POI_TEXTURE_NOSAMPLER(_ClearCoatSmoothnessMap);
+ float _ClearCoatInvertSmoothness;
+ float _ClearCoat;
+ float _ClearCoatSmoothness;
+ float3 _ClearCoatTint;
+ uint _ClearCoatNormalToUse;
+ float _ClearCoatForceLighting;
+ float lighty_clear_boy_uwu_var;
+
+
+ float3 CalculateClearCoatEnvironmentalReflections()
+ {
+ float3 reflectionColor;
+
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_ClearCoatSmoothnessMap, _MainTex, poiMesh.uv[_ClearCoatSmoothnessMapUV], _ClearCoatSmoothnessMapPan));
+ if (_ClearCoatInvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _ClearCoatSmoothness;
+ float roughness = 1 - smoothnessMap;
+
+ lighty_clear_boy_uwu_var = 0;
+
+ float3 reflectedDir = _ClearCoatNormalToUse == 0 ? poiCam.vertexReflectionDir: poiCam.reflectionDir;
+
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ bool no_probe = unity_SpecCube0_HDR.a == 0 && envSample.a == 0;
+
+ UNITY_BRANCH
+ if(_ClearCoatSampleWorld == 0 && no_probe == 0)
+ {
+
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = roughness;
+ envData.reflUVW = BoxProjection(
+ reflectedDir, poiMesh.worldPos.xyz,
+ unity_SpecCube0_ProbePosition,
+ unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax
+ );
+ float3 probe0 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData
+ );
+ envData.reflUVW = BoxProjection(
+ reflectedDir, poiMesh.worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax
+ );
+
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ float3 probe1 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0),
+ unity_SpecCube0_HDR, envData
+ );
+ reflectionColor = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ reflectionColor = probe0;
+ }
+ }
+ else
+ {
+ lighty_clear_boy_uwu_var = 1;
+ reflectionColor = texCUBElod(_ClearCoatCubeMap, float4(reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ }
+
+ if(_ClearCoatForceLighting)
+ {
+ lighty_clear_boy_uwu_var = 1;
+ }
+
+ return reflectionColor * _ClearCoatTint;
+ }
+
+ void calculateAndApplyClearCoat(inout float4 finalColor)
+ {
+ half clearCoatMap = POI2D_SAMPLER_PAN(_ClearCoatMask, _MainTex, poiMesh.uv[_ClearCoatMaskUV], _ClearCoatMaskPan);
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskClearCoat != 4)
+ {
+ clearCoatMap *= blackLightMask[_BlackLightMaskClearCoat];
+ }
+ #endif
+
+ half3 reflectionColor = CalculateClearCoatEnvironmentalReflections();
+
+ float NormalDotView = abs(dot(_ClearCoat, _ClearCoatNormalToUse == 0 ? poiLight.N0DotV: poiLight.nDotV).r);
+ #ifdef POI_LIGHTING
+ finalColor.rgb = lerp(finalColor.rgb, reflectionColor * lerp(1, poiLight.finalLighting, lighty_clear_boy_uwu_var), clearCoatMap * _ClearCoat * clamp(FresnelTerm(_ClearCoat, NormalDotView), 0, 1));
+ //finalColor.rgb += reflectionColor;
+ //finalColor.rgb = finalColor.rgb * (1- (reflectionColor.r + reflectionColor.g + reflectionColor.b)/3) + reflectionColor * clearCoatMap * lerp(1, poiLight.finalLighting, lighty_clear_boy_uwu_var);
+ #else
+ lerp(finalColor.rgb, reflectionColor, clearCoatMap * _ClearCoat * clamp(FresnelTerm(_ClearCoat, NormalDotView), 0, 1));
+ #endif
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiClearCoat.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiClearCoat.cginc.meta
new file mode 100644
index 00000000..c9d5a892
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiClearCoat.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 89c507fdc5104cd4cbab3429d080eae5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiColors.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiColors.cginc
new file mode 100644
index 00000000..f701b5c5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiColors.cginc
@@ -0,0 +1,180 @@
+#ifndef POI_COLOR
+ #define POI_COLOR
+
+ #ifndef pi
+ #define pi float(3.14159265359)
+ #endif
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ static const float HCLmaxL = 0.530454533953517; // == exp(HCLgamma / HCLy0) - 0.5
+
+ float3 HUEtoRGB(in float H)
+ {
+ float R = abs(H * 6 - 3) - 1;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0): float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r): float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 HCYtoRGB(in float3 HCY)
+ {
+
+
+ float3 RGB = HUEtoRGB(HCY.x);
+ float Z = dot(RGB, HCYwts);
+ if (HCY.z < Z)
+ {
+ HCY.y *= HCY.z / Z;
+ }
+ else if(Z < 1)
+ {
+ HCY.y *= (1 - HCY.z) / (1 - Z);
+ }
+ return(RGB - Z) * HCY.y + HCY.z;
+ }
+
+ float3 RGBtoHCY(in float3 RGB)
+ {
+ // Corrected by David Schaeffer
+ float3 HCV = RGBtoHCV(RGB);
+ float Y = dot(RGB, HCYwts);
+ float Z = dot(HUEtoRGB(HCV.x), HCYwts);
+ if (Y < Z)
+ {
+ HCV.y *= Z / (Epsilon + Y);
+ }
+ else
+ {
+ HCV.y *= (1 - Z) / (Epsilon + 1 - Y);
+ }
+ return float3(HCV.x, HCV.y, Y);
+ }
+
+ float3 HCLtoRGB(in float3 HCL)
+ {
+ float3 RGB = 0;
+ if(HCL.z != 0)
+ {
+ float H = HCL.x;
+ float C = HCL.y;
+ float L = HCL.z * HCLmaxL;
+ float Q = exp((1 - C / (2 * L)) * (HCLgamma / HCLy0));
+ float U = (2 * L - C) / (2 * Q - 1);
+ float V = C / Q;
+ float A = (H + min(frac(2 * H) / 4, frac(-2 * H) / 8)) * pi * 2;
+ float T;
+ H *= 6;
+ if(H <= 0.999)
+ {
+ T = tan(A);
+ RGB.r = 1;
+ RGB.g = T / (1 + T);
+ }
+ else if(H <= 1.001)
+ {
+ RGB.r = 1;
+ RGB.g = 1;
+ }
+ else if(H <= 2)
+ {
+ T = tan(A);
+ RGB.r = (1 + T) / T;
+ RGB.g = 1;
+ }
+ else if(H <= 3)
+ {
+ T = tan(A);
+ RGB.g = 1;
+ RGB.b = 1 + T;
+ }
+ else if(H <= 3.999)
+ {
+ T = tan(A);
+ RGB.g = 1 / (1 + T);
+ RGB.b = 1;
+ }
+ else if(H <= 4.001)
+ {
+ RGB.g = 0;
+ RGB.b = 1;
+ }
+ else if(H <= 5)
+ {
+ T = tan(A);
+ RGB.r = -1 / T;
+ RGB.b = 1;
+ }
+ else
+ {
+ T = tan(A);
+ RGB.r = 1;
+ RGB.b = -T;
+ }
+ RGB = RGB * V + U;
+ }
+ return RGB;
+ }
+
+ float3 RGBtoHCL(in float3 RGB)
+ {
+ float3 HCL;
+ float H = 0;
+ float U = min(RGB.r, min(RGB.g, RGB.b));
+ float V = max(RGB.r, max(RGB.g, RGB.b));
+ float Q = HCLgamma / HCLy0;
+ HCL.y = V - U;
+ if(HCL.y != 0)
+ {
+ H = atan2(RGB.g - RGB.b, RGB.r - RGB.g) / pi;
+ Q *= U / V;
+ }
+ Q = exp(Q);
+ HCL.x = frac(H / 2 - min(frac(H), frac(-H)) / 6);
+ HCL.y *= Q;
+ HCL.z = lerp(-U, V, Q) / (HCLmaxL * 2);
+ return HCL;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiColors.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiColors.cginc.meta
new file mode 100644
index 00000000..07bfcf17
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiColors.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f798bf99177b0494b91b6e2c134d1ecf
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiData.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiData.cginc
new file mode 100644
index 00000000..be2138b5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiData.cginc
@@ -0,0 +1,188 @@
+#ifndef POI_DATA
+ #define POI_DATA
+
+ float _ParallaxBias;
+
+ void calculateAttenuation(v2f i)
+ {
+ #if defined(POINT) || defined(SPOT)
+ POI_LIGHT_ATTENUATION(attenuation, shadow, i, i.worldPos.xyz)
+ poiLight.additiveShadow = shadow;
+ #else
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz)
+ #endif
+ poiLight.attenuation = attenuation;
+ }
+
+ void calculateLightingData(in v2f i)
+ {
+ #ifdef FORWARD_BASE_PASS
+ //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 magic = saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 normalLight = saturate(_LightColor0.rgb);
+ poiLight.color = saturate(magic + normalLight);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.color = _LightColor0.rgb;
+ #endif
+ #endif
+
+ #ifdef VERTEXLIGHT_ON
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vDotNL = max(0, poiLight.vDotNL * corr);
+ poiLight.vAttenuationDotNL = poiLight.vAttenuation * poiLight.vDotNL;
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ poiLight.vDotNL[index] = dot(poiMesh.normals[1], -poiLight.vDirection[index]);
+ poiLight.vCorrectedDotNL[index] = .5 * (poiLight.vDotNL[index] + 1);
+
+ #ifdef POI_VAR_DOTLH
+ poiLight.vDotLH[index] = saturate(dot(poiLight.vDirection[index], poiLight.vHalfDir[index]));
+ #endif
+
+ #ifdef POI_VAR_DOTNH
+ poiLight.vDotNH[index] = saturate(dot(poiMesh.normals[1], poiLight.vHalfDir[index]));
+ #endif
+ }
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ poiLight.direction = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos);
+ #endif
+ #endif
+
+ poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir);
+
+ #ifdef POI_VAR_DOTNH
+ poiLight.dotNH = saturate(dot(poiMesh.normals[1], poiLight.halfDir));
+ #endif
+
+ #ifdef POI_VAR_DOTLH
+ poiLight.dotLH = saturate(dot(poiLight.direction, poiLight.halfDir));
+ #endif
+
+ poiLight.nDotV = dot(poiMesh.normals[1], poiCam.viewDir);
+ poiLight.N0DotV = dot(poiMesh.normals[0], poiCam.viewDir);
+ poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction);
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ }
+
+ float3 CreateBinormal(float3 normal, float3 tangent, float binormalSign)
+ {
+ return cross(normal, tangent.xyz) * (binormalSign * unity_WorldTransformParams.w);
+ }
+
+ void InitializeMeshData(inout v2f i, uint facing)
+ {
+ poiMesh.normals[0] = normalize(i.normal);
+ poiMesh.binormal = CreateBinormal(i.normal, i.tangent.xyz, i.tangent.w);
+ poiMesh.tangent = i.tangent.xyz;
+
+ #ifndef OUTLINE
+ if (!facing)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiMesh.worldPos = i.worldPos;
+ poiMesh.localPos = i.localPos;
+ poiMesh.barycentricCoordinates = i.barycentricCoordinates;
+ poiMesh.uv[0] = i.uv0.xy;
+ poiMesh.uv[1] = i.uv0.zw;
+ poiMesh.uv[2] = i.uv1.xy;
+ poiMesh.uv[3] = i.uv1.zw;
+
+ #ifdef POI_UV_DISTORTION
+ poiMesh.uv[4] = calculateDistortionUV(i.uv0.xy);
+ #else
+ poiMesh.uv[4] = poiMesh.uv[0];
+ #endif
+
+ poiMesh.vertexColor = i.vertexColor;
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.modelPos = i.modelPos;
+
+ #ifdef FUR
+ poiMesh.furAlpha = i.furAlpha;
+ #endif
+ }
+
+ void initializeCamera(v2f i)
+ {
+ poiCam.viewDir = normalize(_WorldSpaceCameraPos - i.worldPos);
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.clipPos = i.pos;
+ #if defined(GRAIN)
+ poiCam.screenPos = i.screenPos;
+ #endif
+
+ poiCam.tangentViewDir = normalize(i.tangentViewDir);
+ poiCam.tangentViewDir.xy /= (poiCam.tangentViewDir.z + _ParallaxBias);
+ }
+
+ void calculateTangentData()
+ {
+ poiTData.tangentTransform = float3x3(poiMesh.tangent, poiMesh.binormal, poiMesh.normals[0]);
+ poiTData.tangentToWorld = transpose(float3x3(poiMesh.tangent, poiMesh.binormal, poiMesh.normals[0]));
+ }
+
+ void InitData(inout v2f i, uint facing)
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+
+ calculateAttenuation(i);
+
+ InitializeMeshData(i, facing);
+ initializeCamera(i);
+ calculateTangentData();
+ }
+
+ void CalculateReflectionData()
+ {
+ #if defined(_METALLICGLOSSMAP) || defined(_COLORCOLOR_ON)
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiData.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiData.cginc.meta
new file mode 100644
index 00000000..b03f1b67
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiData.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9f6b6296870edcb45aa0a77fffaeec5c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDebug.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDebug.cginc
new file mode 100644
index 00000000..4792487c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDebug.cginc
@@ -0,0 +1,102 @@
+#ifndef POI_DEBUG
+ #define POI_DEBUG
+
+ float _DebugEnabled;
+ uint _DebugMeshData;
+ uint _DebugLightingData;
+ uint _DebugCameraData;
+
+ void displayDebugInfo(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if (_DebugEnabled != 0)
+ {
+ //Mesh Data
+ if (_DebugMeshData == 1)
+ {
+ finalColor.rgb = poiMesh.normals[0];
+ return;
+ }
+ else if(_DebugMeshData == 2)
+ {
+ finalColor.rgb = poiMesh.normals[1];
+ return;
+ }
+ else if(_DebugMeshData == 3)
+ {
+ finalColor.rgb = poiMesh.tangent;
+ return;
+ }
+ else if(_DebugMeshData == 4)
+ {
+ finalColor.rgb = poiMesh.binormal;
+ return;
+ }
+
+ #ifdef POI_LIGHTING
+ if (_DebugLightingData == 1)
+ {
+ finalColor.rgb = poiLight.attenuation;
+ return;
+ }
+ else if(_DebugLightingData == 2)
+ {
+ finalColor.rgb = poiLight.directLighting;
+ return;
+ }
+ else if(_DebugLightingData == 3)
+ {
+ finalColor.rgb = poiLight.indirectLighting;
+ return;
+ }
+ else if(_DebugLightingData == 4)
+ {
+ finalColor.rgb = poiLight.lightMap;
+ return;
+ }
+ else if(_DebugLightingData == 5)
+ {
+ finalColor.rgb = poiLight.rampedLightMap;
+ return;
+ }
+ else if(_DebugLightingData == 6)
+ {
+ finalColor.rgb = poiLight.finalLighting;
+ return;
+ }
+ else if(_DebugLightingData == 7)
+ {
+ finalColor.rgb = poiLight.nDotL;
+ return;
+ }
+ #endif
+
+ if(_DebugCameraData == 1)
+ {
+ finalColor.rgb = poiCam.viewDir;
+ return;
+ }
+ else if(_DebugCameraData == 2)
+ {
+ finalColor.rgb = poiCam.tangentViewDir;
+ return;
+ }
+ else if(_DebugCameraData == 3)
+ {
+ finalColor.rgb = poiCam.forwardDir;
+ return;
+ }
+ else if(_DebugCameraData == 4)
+ {
+ finalColor.rgb = poiCam.worldPos;
+ return;
+ }
+ else if(_DebugCameraData == 5)
+ {
+ finalColor.rgb = poiCam.viewDotNormal;
+ return;
+ }
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDebug.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDebug.cginc.meta
new file mode 100644
index 00000000..1f65a768
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDebug.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: dbc4ce40ad3fd4b4697163e382488ce1
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDecal.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDecal.cginc
new file mode 100644
index 00000000..3a8ac67c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDecal.cginc
@@ -0,0 +1,45 @@
+#ifndef POI_DECAL
+ #define POI_DECAL
+
+ POI_TEXTURE_NOSAMPLER(_DecalTexture);
+ POI_TEXTURE_NOSAMPLER(_DecalMask);
+ float4 _DecalColor;
+ fixed _DecalTiled;
+ fixed _DecalBlendAdd;
+ fixed _DecalBlendMultiply;
+ fixed _DecalBlendReplace;
+ half _DecalRotation;
+ half2 _DecalScale;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+
+ void applyDecal(inout float4 albedo)
+ {
+ float2 uv = poiMesh.uv[_DecalTextureUV];
+ float2 decalCenter = _DecalPosition;
+ float theta = radians(_DecalRotation + _Time.z * _DecalRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _DecalScale / 2 + _DecalPosition, _DecalScale / 2 + _DecalPosition, float2(0, 0), float2(1, 1));
+
+ half decalAlpha = 1;
+ //float2 uv = TRANSFORM_TEX(poiMesh.uv[_DecalTextureUV], _DecalTexture) + _Time.x * _DecalTexturePan;
+ float4 decalColor = POI2D_SAMPLER_PAN(_DecalTexture, _MainTex, uv, _DecalTexturePan);
+ decalAlpha *= POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiMesh.uv[_DecalMaskUV], _DecalMaskPan).r;
+ UNITY_BRANCH
+ if (!_DecalTiled)
+ {
+ if(uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ decalAlpha = 0;
+ }
+ }
+
+ albedo.rgb = lerp(albedo.rgb, decalColor.rgb, decalColor.a * decalAlpha * _DecalBlendReplace);
+ albedo.rgb *= lerp(1, decalColor.rgb, decalColor.a * decalAlpha * _DecalBlendMultiply);
+ albedo.rgb += decalColor.rgb * decalColor.a * decalAlpha * _DecalBlendAdd;
+ albedo = saturate(albedo);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDecal.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDecal.cginc.meta
new file mode 100644
index 00000000..7155e4f3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDecal.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 76df50f2fe87f904a8eec955c0c499ff
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDefines.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDefines.cginc
new file mode 100644
index 00000000..44465e2c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDefines.cginc
@@ -0,0 +1,21 @@
+#ifndef POI_DEFINES
+ #define POI_DEFINES
+
+ #define DielectricSpec float4(0.04, 0.04, 0.04, 1.0 - 0.04)
+
+ #ifdef _SPECGLOSSMAP // Specular
+ #ifndef POI_VAR_DOTNH
+ #define POI_VAR_DOTNH
+ #endif
+ #ifndef POI_VAR_DOTLH
+ #define POI_VAR_DOTLH
+ #endif
+ #endif
+
+ #ifdef LOD_FADE_CROSSFADE // Lighting
+ #ifndef POI_VAR_DOTNL
+ #define POI_VAR_DOTNL
+ #endif
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDefines.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDefines.cginc.meta
new file mode 100644
index 00000000..0e2813cb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDefines.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c82aec380114d0a4198a00053c3028dd
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDepthColor.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDepthColor.cginc
new file mode 100644
index 00000000..1c746bac
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDepthColor.cginc
@@ -0,0 +1,43 @@
+#ifndef POI_DEPTH_COLOR
+ #define POI_DEPTH_COLOR
+
+
+ #ifndef POI_CAMERA_DEPTH
+ #define POI_CAMERA_DEPTH
+ sampler2D _CameraDepthTexture;
+ #endif
+
+ float4 _DepthGlowColor;
+ float _DepthGlowEmission;
+ float _FadeLength;
+ float _DepthAlphaMin;
+ float _DepthAlphaMax;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DepthGradient); float4 _DepthGradient_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DepthMask); float4 _DepthMask_ST;
+
+ void applyDepthColor(inout float4 finalColor, inout float3 finalEmission, float4 screenPos, float4 clipPos)
+ {
+ if (!IsInMirror())
+ {
+ _FadeLength *= 0.01;
+ float depth = DecodeFloatRG(tex2Dproj(_CameraDepthTexture, screenPos));
+ depth = Linear01Depth(depth);
+ if(depth != 1)
+ {
+ float diff = distance(depth, Linear01Depth(clipPos.z));
+ float intersect = 0;
+ if(diff > 0)
+ {
+ intersect = clamp(1 - smoothstep(0, _ProjectionParams.w * _FadeLength, diff), 0, 1);
+ }
+ half4 depthGradient = UNITY_SAMPLE_TEX2D_SAMPLER(_DepthGradient, _MainTex, intersect);
+ half3 depthMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DepthMask, _MainTex, poiMesh.uv[0]);
+ half3 depthColor = depthGradient.rgb * _DepthGlowColor.rgb;
+ finalEmission += depthColor * _DepthGlowEmission * intersect * depthMask;
+ finalColor.rgb = lerp(finalColor.rgb, depthColor, intersect * depthMask);
+ finalColor.a *= lerp(_DepthAlphaMax, _DepthAlphaMin, intersect);
+ }
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDepthColor.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDepthColor.cginc.meta
new file mode 100644
index 00000000..ad52a9f2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDepthColor.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d3087941009844f4a8175b049e249e1b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDissolve.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDissolve.cginc
new file mode 100644
index 00000000..b30cfbd0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDissolve.cginc
@@ -0,0 +1,216 @@
+#ifndef POI_DISSOLVE
+ #define POI_DISSOLVE
+
+ uint _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient; float4 _DissolveEdgeGradient_ST;
+ float _DissolveEdgeEmission;
+ float4 _DissolveTextureColor;
+ POI_TEXTURE_NOSAMPLER(_DissolveToTexture);
+ POI_TEXTURE_NOSAMPLER(_DissolveNoiseTexture);
+ POI_TEXTURE_NOSAMPLER(_DissolveDetailNoise);
+ POI_TEXTURE_NOSAMPLER(_DissolveMask);
+ float _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ uint _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ // Masking
+ uint _DissolveEmissionSide;
+ uint _DissolveEmission1Side;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+ //Globals
+ #ifndef POI_SHADOW
+ void calculateDissolve()
+ {
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiMesh.uv[_DissolveMaskUV], _DissolveMaskPan).r;
+ dissolveToTexture = POI2D_SAMPLER_PAN(_DissolveToTexture, _MainTex, poiMesh.uv[_DissolveToTextureUV], _DissolveToTexturePan) * _DissolveTextureColor;
+ float dissolveNoiseTexture = POI2D_SAMPLER_PAN(_DissolveNoiseTexture, _MainTex, poiMesh.uv[_DissolveNoiseTextureUV], _DissolveNoiseTexturePan);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if(_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoisePan);
+
+ if(_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if(_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if(_ContinuousDissolve != 0)
+ {
+ _DissolveAlpha = sin(_Time.y * _ContinuousDissolve) * .5 + .5;
+ }
+ _DissolveAlpha *= dissolveMask;
+ dissolveAlpha = _DissolveAlpha;
+ edgeAlpha = 0;
+
+ UNITY_BRANCH
+ if(_DissolveType == 1) // Basic
+ {
+ _DissolveAlpha = remap(_DissolveAlpha, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = _DissolveAlpha;
+ //Adjust detail strength to avoid artifacts
+ _DissolveDetailStrength *= smoothstep(1, .99, _DissolveAlpha);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * _DissolveDetailStrength);
+
+ noise = saturate(noise + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(noise, _DissolveAlpha + _DissolveEdgeWidth, _DissolveAlpha, 0, 1) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 2) // Point to Point
+ {
+ float3 direction;
+ float3 currentPos;
+ float distanceTo = 0;
+ direction = normalize(_DissolveEndPoint - _DissolveStartPoint);
+ currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha);
+ if (_DissolveP2PWorldLocal == 0)
+ {
+ distanceTo = dot(poiMesh.localPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ albedo = lerp(albedo, dissolveToTexture, dissolveAlpha);
+
+ if(_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, TRANSFORM_TEX(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient)) * _DissolveEdgeColor;
+ albedo.rgb = lerp(albedo.rgb, edgeColor.rgb, remapClamped(edgeAlpha, 0, 1 - _DissolveEdgeHardness, 0, 1));
+ }
+
+
+
+
+ /*
+ UNITY_BRANCH
+ if (_Blend != 0)
+ {
+ float blendNoise = tex2D(_BlendNoiseTexture, TRANSFORM_TEX(uv, _BlendNoiseTexture));
+ blendAlpha = _BlendAlpha;
+ if(_AutoBlend > 0)
+ {
+ blendAlpha = (clamp(sin(_Time.y * _AutoBlendSpeed / _AutoBlendDelay) * (_AutoBlendDelay + 1), -1, 1) + 1) / 2;
+ }
+ blendAlpha = lerp(saturate((blendNoise - 1) + blendAlpha * 2), step((1-blendAlpha) * 1.001, blendNoise), _Blend - 1);
+
+ float4 blendCol = tex2D(_BlendTexture, TRANSFORM_TEX(uv, _BlendTexture)) * _BlendTextureColor;
+ diffuse = lerp(diffuse, blendCol, blendAlpha);
+ mainTexture.a = lerp(mainTexture.a, blendCol.a, blendAlpha);
+ }
+ */
+ }
+
+ void applyDissolveEmission(inout float3 finalEmission)
+ {
+ finalEmission += lerp(0, dissolveToTexture * _DissolveToEmissionStrength, dissolveAlpha);
+ finalEmission += lerp(0, edgeColor.rgb * _DissolveEdgeEmission, remapClamped(edgeAlpha, 0, 1 - _DissolveEdgeHardness, 0, 1));
+ }
+
+ #endif
+
+ float calculateShadowDissolveAlpha(float3 worldPos, float3 localPos, float2 uv)
+ {
+ float dissolveMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveMask, _MainTex, TRANSFORM_TEX(uv, _DissolveMask)).r;
+ dissolveToTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveToTexture, _MainTex, TRANSFORM_TEX(uv, _DissolveToTexture) + _Time.y * _DissolveToTexturePan) * _DissolveTextureColor;
+ float dissolveNoiseTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveNoiseTexture, _MainTex, TRANSFORM_TEX(uv, _DissolveNoiseTexture) + _Time.y * _DissolveNoiseTexturePan);
+ float dissolveDetailNoise = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveDetailNoise, _MainTex, TRANSFORM_TEX(uv, _DissolveDetailNoise) + _Time.y * _DissolveDetailNoisePan);
+
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if(_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if(_ContinuousDissolve != 0)
+ {
+ _DissolveAlpha = sin(_Time.y * _ContinuousDissolve) * .5 + .5;
+ }
+ _DissolveAlpha *= dissolveMask;
+ dissolveAlpha = _DissolveAlpha;
+ edgeAlpha = 0;
+
+ UNITY_BRANCH
+ if(_DissolveType == 1) // Basic
+ {
+ _DissolveAlpha = remap(_DissolveAlpha, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = _DissolveAlpha;
+ //Adjust detail strength to avoid artifacts
+ _DissolveDetailStrength *= smoothstep(1, .99, _DissolveAlpha);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * _DissolveDetailStrength);
+
+ noise = saturate(noise + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(noise, _DissolveAlpha + _DissolveEdgeWidth, _DissolveAlpha, 0, 1) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 2) // Point to Point
+ {
+ float3 direction;
+ float3 currentPos;
+ float distanceTo = 0;
+ direction = normalize(_DissolveEndPoint - _DissolveStartPoint);
+ currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha);
+ if (_DissolveP2PWorldLocal == 0)
+ {
+ distanceTo = dot(localPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ dissolveAlpha = step(distanceTo, 0);
+ }
+ else
+ {
+ distanceTo = dot(worldPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ dissolveAlpha = step(distanceTo, 0);
+ }
+ }
+
+ return lerp(1, dissolveToTexture, dissolveAlpha).a;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDissolve.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDissolve.cginc.meta
new file mode 100644
index 00000000..a4893c72
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDissolve.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d7299b35e8e79f9478287dfeb6ee98ca
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDithering.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDithering.cginc
new file mode 100644
index 00000000..1540b5eb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDithering.cginc
@@ -0,0 +1,34 @@
+#ifndef POI_DITHERING
+ #define POI_DITHERING
+ fixed _DitheringEnabled;
+ fixed _DitherGradient;
+
+ half calcDither(half2 grabPos)
+ {
+ half dither = Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ return dither;
+ }
+
+ #ifndef POI_SHADOW
+ void applyDithering(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if (_DitheringEnabled)
+ {
+ half dither = calcDither(poiCam.screenUV.xy);
+ finalColor.a = finalColor.a - (dither * (1 - finalColor.a) * _DitherGradient);
+ }
+ }
+ #else
+ void applyShadowDithering(inout float alpha, float2 screenUV)
+ {
+ UNITY_BRANCH
+ if(_DitheringEnabled)
+ {
+ half dither = calcDither(screenUV);
+ alpha = alpha - (dither * (1 - alpha) * _DitherGradient);
+ }
+ }
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDithering.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDithering.cginc.meta
new file mode 100644
index 00000000..004bc81b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiDithering.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: de22a513128b5d440aa4777e879e5288
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEmission.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEmission.cginc
new file mode 100644
index 00000000..12d20eb7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEmission.cginc
@@ -0,0 +1,198 @@
+#ifndef POI_EMISSION
+ #define POI_EMISSION
+
+ float4 _EmissionColor;
+ POI_TEXTURE_NOSAMPLER(_EmissionMap);
+ POI_TEXTURE_NOSAMPLER(_EmissionMask);
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EnableEmission;
+ float _EmissionHueShift;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _ScrollingEmission;
+ float _EnableGITDEmission;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ uint _GITDEWorldOrMesh;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EmissionHueShiftEnabled;
+ float _EmissionBlinkingOffset;
+ float _EmissionScrollingOffset;
+
+ float4 _EmissionColor1;
+ POI_TEXTURE_NOSAMPLER(_EmissionMap1);
+ POI_TEXTURE_NOSAMPLER(_EmissionMask1);
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ uint _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+
+ float _EmissionReplace;
+
+ float _EmissionScrollingUseCurve;
+ float _EmissionScrollingUseCurve1;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve); float4 _EmissionScrollingCurve_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve1); float4 _EmissionScrollingCurve1_ST;
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled)
+ {
+ float glowInTheDarkMultiplier = 1;
+
+ #ifdef POI_LIGHTING
+ float3 lightValue = _GITDEWorldOrMesh ? poiLight.finalLighting.rgb: poiLight.directLighting.rgb;
+ float gitdeAlpha = (clamp(poiMax(lightValue), minLight, maxLight) - minLight) / (maxLight - minLight);
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ glowInTheDarkMultiplier = lerp(1, glowInTheDarkMultiplier, enabled);
+ #endif
+
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, in float enabled, float offset)
+ {
+ float phase = 0;
+ phase = dot(poiMesh.localPos, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ float width = scrollWidth;
+ phase = (pow(phase, width) + pow(1 - phase, width * 4)) * 0.5;
+ return lerp(1, phase, enabled);
+ }
+
+ 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;
+ }
+
+ float3 calculateEmissionNew(in float4 baseColor, inout float4 finalColor)
+ {
+ // First Emission
+ float3 emission0 = 0;
+ float emissionStrength0 = _EmissionStrength;
+ float3 emissionColor0 = 0;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission);
+
+ UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiMesh.uv[_EmissionMapUV], _EmissionMapPan) * lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed) * lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ }
+
+ UNITY_BRANCH
+ if(_EmissionScrollingUseCurve)
+ {
+ emissionStrength0 *= lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve) + (dot(poiMesh.localPos, _EmissiveScroll_Direction) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity), _ScrollingEmission);
+ }
+ else
+ {
+ emissionStrength0 *= calculateScrollingEmission(_EmissiveScroll_Direction, _EmissiveScroll_Velocity, _EmissiveScroll_Interval, _EmissiveScroll_Width, _ScrollingEmission, _EmissionScrollingOffset);
+ }
+
+ emissionStrength0 *= calculateBlinkingEmission(_EmissiveBlink_Min, _EmissiveBlink_Max, _EmissiveBlink_Velocity, _EmissionBlinkingOffset);
+ emissionColor0 = hueShift(emissionColor0, _EmissionHueShift * _EmissionHueShiftEnabled);
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMaskUV], _EmissionMask) + _Time.x * _EmissionMaskPan);
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = emissionStrength0 * emissionColor0;
+
+ #ifdef POI_DISSOLVE
+ emission0 *= lerp(1 - dissolveAlpha, dissolveAlpha, _DissolveEmissionSide);
+ #endif
+
+ // Second Emission
+ float3 emission1 = 0;
+ float emissionStrength1 = 0;
+ float3 emissionColor1 = 0;
+
+ UNITY_BRANCH
+ if (_EnableEmission1)
+ {
+ emissionStrength1 = _EmissionStrength1;
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1);
+
+ UNITY_BRANCH
+ if(!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiMesh.uv[_EmissionMap1UV], _EmissionMap1Pan) * lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;
+ }
+
+ UNITY_BRANCH
+ if(_EmissionScrollingUseCurve1)
+ {
+ emissionStrength1 *= lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1) + (dot(poiMesh.localPos, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1), _ScrollingEmission1);
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _ScrollingEmission1, _EmissionScrollingOffset1);
+ }
+
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ emissionColor1 = hueShift(emissionColor1, _EmissionHueShift1 * _EmissionHueShiftEnabled1);
+ float emissionMask1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask1, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMask1UV], _EmissionMask1) + _Time.x * _EmissionMask1Pan);
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = emissionStrength1 * emissionColor1;
+
+ #ifdef POI_DISSOLVE
+ emission1 *= lerp(1 - dissolveAlpha, dissolveAlpha, _DissolveEmission1Side);
+ #endif
+ }
+
+ finalColor.rgb = lerp(finalColor.rgb, saturate(emissionColor0 + emissionColor1), saturate(emissionStrength0 + emissionStrength1) * _EmissionReplace * poiMax(emission0 + emission1));
+
+ return emission0 + emission1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEmission.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEmission.cginc.meta
new file mode 100644
index 00000000..2e723a79
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEmission.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 699176517ebc7e948b54546d060b7052
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEnvironmentalRimLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEnvironmentalRimLighting.cginc
new file mode 100644
index 00000000..5c3b42ee
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEnvironmentalRimLighting.cginc
@@ -0,0 +1,43 @@
+#ifndef POI_ENVIRONMENTAL_RIM
+ #define POI_ENVIRONMENTAL_RIM
+
+ //enviro rim
+ float _EnableEnvironmentalRim;
+ POI_TEXTURE_NOSAMPLER(_RimEnviroMask);
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+
+ float3 calculateEnvironmentalRimLighting()
+ {
+ float enviroRimAlpha = saturate(1 - smoothstep(min(_RimEnviroSharpness, _RimEnviroWidth), _RimEnviroWidth, poiCam.viewDotNormal));
+ _RimEnviroBlur *= 1.7 - 0.7 * _RimEnviroBlur;
+
+ float3 enviroRimColor = 0;
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.normals[1], _RimEnviroBlur * UNITY_SPECCUBE_LOD_STEPS);
+ enviroRimColor = DecodeHDR(reflectionData, unity_SpecCube0_HDR);
+ }
+
+ half enviroMask = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ return lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * albedo.rgb), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta
new file mode 100644
index 00000000..e8960afe
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 2648515d85a969d4ca1ae5850fd8ee57
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFlipbook.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFlipbook.cginc
new file mode 100644
index 00000000..0d76d918
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFlipbook.cginc
@@ -0,0 +1,155 @@
+#ifndef POI_FLIPBOOK
+ #define POI_FLIPBOOK
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST;
+ float4 _FlipbookColor;
+ float _FlipbookFPS;
+ uint _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float _FlipbookTiled;
+ int _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ uint _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+ POI_TEXTURE_NOSAMPLER(_FlipbookMask);
+
+ // anim
+ uint _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Global
+ float4 flipBookPixel;
+ float4 flipBookPixelMultiply;
+ float flipBookMask;
+
+ #ifndef POI_SHADOW
+
+ void calculateFlipbook()
+ {
+ flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ _FlipbookScaleOffset.xy = 1 - _FlipbookScaleOffset.xy;
+ float2 uv = frac(poiMesh.uv[_FlipbookTexArrayUV]);
+ float theta = radians(_FlipbookRotation + _Time.z * _FlipbookRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = _FlipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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);
+
+ float2 newUV = remap(uv, float2(0, 0) + _FlipbookScaleOffset.xy / 2 + _FlipbookScaleOffset.zw, float2(1, 1) - _FlipbookScaleOffset.xy / 2 + _FlipbookScaleOffset.zw, float2(0, 0), float2(1, 1));
+
+ UNITY_BRANCH
+ if (_FlipbookTiled == 0)
+ {
+ if(max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ flipBookPixel = 0;
+ return;
+ }
+ }
+
+ uint currentFrame = floor(_FlipbookCurrentFrame) % _FlipbookTotalFrames;
+ if(_FlipbookCurrentFrame < 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, currentFrame));
+ UNITY_BRANCH
+ if(_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if(_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = _FlipbookColor.rgb;
+ }
+ else
+ {
+ flipBookPixel.rgb *= _FlipbookColor.rgb;
+ }
+ }
+ void applyFlipbook(inout float4 finalColor)
+ {
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if(_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ finalColor.rgb = lerp(finalColor, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask);
+ finalColor.rgb = finalColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask;
+ finalColor.rgb = finalColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply);
+
+ UNITY_BRANCH
+ if(_FlipbookAlphaControlsFinalAlpha)
+ {
+ finalColor.a = lerp(finalColor.a, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+ void applyFlipbookEmission(inout float3 finalEmission)
+ {
+ finalEmission += lerp(0, flipBookPixel.rgb * _FlipbookEmissionStrength, flipBookPixel.a * _FlipbookColor.a * flipBookMask);
+ }
+
+ #else
+
+ float applyFlipbookAlphaToShadow(float2 uv)
+ {
+ UNITY_BRANCH
+ if(_FlipbookAlphaControlsFinalAlpha)
+ {
+ float flipbookShadowAlpha = 0;
+
+ _FlipbookScaleOffset.xy = 1 - _FlipbookScaleOffset.xy;
+ float theta = radians(_FlipbookRotation);
+
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = _FlipbookScaleOffset.zw + .5;
+ 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);
+
+ float2 newUV = remap(uv, float2(0, 0) + _FlipbookScaleOffset.xy / 2 + _FlipbookScaleOffset.zw, float2(1, 1) - _FlipbookScaleOffset.xy / 2 + _FlipbookScaleOffset.zw, float2(0, 0), float2(1, 1));
+
+
+ uint currentFrame = floor(_FlipbookCurrentFrame) % _FlipbookTotalFrames;
+ if(_FlipbookCurrentFrame < 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ half4 flipbookColor = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, currentFrame));
+
+ if(_FlipbookIntensityControlsAlpha)
+ {
+ flipbookColor.a = poiMax(flipbookColor.rgb);
+ }
+
+ UNITY_BRANCH
+ if(_FlipbookTiled == 0)
+ {
+ if(max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ flipbookColor.a = 0;
+ }
+ }
+ return flipbookColor.a * _FlipbookColor.a;
+ }
+ return 1;
+ }
+
+ #endif
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFlipbook.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFlipbook.cginc.meta
new file mode 100644
index 00000000..4357b7d3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFlipbook.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b020bec52b785534c98a1865ceff33c4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFrag.cginc
new file mode 100644
index 00000000..83f44ecf
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFrag.cginc
@@ -0,0 +1,360 @@
+#ifndef POIFRAG
+ #define POIFRAG
+
+ float _MainEmissionStrength;
+ float _IgnoreFog;
+ half _GIEmissionMultiplier;
+ uint _IridescenceTime;
+ uint _AlphaToMask;
+ float _ForceOpaque;
+
+ // Built-in uniforms for "vertex lights"
+ //uniform float4 unity_LightColor[4];
+ // array of the colors of the 4 light sources
+ //uniform float4 unity_4LightPosX0;
+ // x coordinates of the 4 light sources in world space
+ //uniform float4 unity_4LightPosY0;
+ // y coordinates of the 4 light sources in world space
+ //uniform float4 unity_4LightPosZ0;
+ // z coordinates of the 4 light sources in world space
+ //uniform float4 unity_4LightAtten0;
+ // scale factors for attenuation with squared distance
+ // uniform vec4 unity_LightPosition[4] is apparently not
+ // always correctly set in Unity 3.4
+ // uniform vec4 unity_LightAtten[4] is apparently not
+ // always correctly set in Unity 3.4
+
+ float4 frag(v2f i, uint facing: SV_IsFrontFace): SV_Target
+ {
+ #ifndef POI_LIGHTING
+ #ifdef FORWARD_ADD_PASS
+ return 0;
+ #endif
+ #endif
+
+ float3 finalLighting = 1;
+ float3 finalSpecular0 = 0;
+ float3 finalSpecular1 = 0;
+ float3 finalEnvironmentalRim = 0;
+ float3 finalSSS = 0;
+ fixed lightingAlpha = 1;
+ float3 IridescenceEmission = 0;
+ float bakedCubemap = 0; // Whether or not metallic should run before or after lighting multiplication
+ float3 spawnInEmission = 0;
+ float3 voronoiEmission = 0;
+ float3 matcapEmission = 0;
+ finalEmission = 0;
+ poiMesh.isFrontFace = facing;
+ //This has to be first because it modifies the UVs for the rest of the functions
+
+ #ifdef POI_DATA
+ InitData(i, facing);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ createBlackLightMask();
+
+ UNITY_BRANCH
+ if (_BlackLightMaskDebug)
+ {
+ return float4(blackLightMask.rgb, 1);
+ }
+ #endif
+
+ // This has to happen in init because it alters UV data globally
+ #ifdef POI_PARALLAX
+ calculateandApplyParallax();
+ #endif
+
+ #ifdef POI_MAINTEXTURE
+ initTextureData();
+ #endif
+
+ #ifdef POI_DECAL
+ applyDecal(albedo);
+ #endif
+
+ #ifdef POI_DATA
+ calculateLightingData(i);
+ #endif
+
+
+ #ifdef POI_IRIDESCENCE
+ UNITY_BRANCH
+ if (_IridescenceTime == 0)
+ {
+ IridescenceEmission = applyIridescence(albedo);
+ }
+ #endif
+
+ #ifdef POI_VORONOI
+ applyVoronoi(albedo, voronoiEmission);
+ #endif
+
+ #ifdef POI_MSDF
+ ApplyTextOverlayColor(albedo);
+ #endif
+
+ #ifdef POI_LIGHTING
+ finalLighting = calculateLighting(albedo.rgb);
+ #endif
+
+ #ifdef POI_ENVIRONMENTAL_RIM
+ finalEnvironmentalRim = calculateEnvironmentalRimLighting();
+ #endif
+
+ #if defined(POI_METAL) || defined(POI_CLEARCOAT)
+ CalculateReflectionData();
+ #endif
+
+ #ifdef POI_DATA
+ distanceFade();
+ #endif
+
+ #ifdef POI_RANDOM
+ albedo.a *= i.angleAlpha;
+ #endif
+
+ #ifdef CUTOUT
+ UNITY_BRANCH
+ if(_AlphaToMask == 0)
+ {
+ applyDithering(albedo);
+ }
+ #endif
+
+ albedo.a = max(_ForceOpaque, albedo.a);
+
+ #ifdef POI_FLIPBOOK
+ calculateFlipbook();
+ #endif
+
+ #ifdef POI_LIGHTING
+ #ifdef SUBSURFACE
+ finalSSS = calculateSubsurfaceScattering();
+ #endif
+ #endif
+
+ #ifdef POI_RIM
+ calculateRimLighting();
+ #endif
+
+ #ifdef PANOSPHERE
+ calculatePanosphere();
+ #endif
+
+ finalColor = albedo;
+
+
+
+ applySpawnIn(finalColor, spawnInEmission, poiMesh.uv[0], poiMesh.localPos);
+
+ #ifdef MATCAP
+ matcapEmission = applyMatcap(finalColor);
+ #endif
+
+ #ifdef PANOSPHERE
+ applyPanosphereColor(finalColor);
+ #endif
+
+ #ifdef POI_FLIPBOOK
+ applyFlipbook(finalColor);
+ #endif
+
+ #ifndef OPAQUE
+ clip(finalColor.a - _Clip);
+ #endif
+
+ #ifdef POI_RIM
+ applyRimColor(finalColor);
+ #endif
+
+ #ifdef POI_DEPTH_COLOR
+ applyDepthColor(finalColor, finalEmission, poiCam.screenPos, poiCam.clipPos);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ UNITY_BRANCH
+ if(_IridescenceTime == 1)
+ {
+ IridescenceEmission = applyIridescence(finalColor);
+ }
+ #endif
+
+ float4 finalColorBeforeLighting = finalColor;
+
+ #ifdef POI_SPECULAR
+ finalSpecular0 = calculateSpecular(finalColorBeforeLighting);
+
+ //return float4(finalSpecular0, 1);
+ #endif
+
+ #ifdef POI_PARALLAX
+ calculateAndApplyInternalParallax(finalColor);
+ #endif
+
+ #if defined(FORWARD_BASE_PASS)
+ #ifdef POI_LIGHTING
+ #ifdef POI_SPECULAR
+ //applyLightingToSpecular();
+ //applySpecular(finalColor);
+ #endif
+ #endif
+ #endif
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ finalEmission += finalColorBeforeLighting.rgb * _MainEmissionStrength * albedo.a;
+ finalEmission += wireframeEmission;
+ finalEmission += IridescenceEmission;
+ finalEmission += spawnInEmission;
+ finalEmission += voronoiEmission;
+ finalEmission += matcapEmission;
+ UNITY_BRANCH
+ if (_BackFaceEnabled)
+ {
+ finalEmission += BackFaceColor * _BackFaceEmissionStrength;
+ }
+
+ #ifdef PANOSPHERE
+ applyPanosphereEmission(finalEmission);
+ #endif
+
+ #ifdef POI_EMISSION
+ finalEmission += calculateEmissionNew(finalColorBeforeLighting, finalColor);
+ #endif
+
+ #ifdef POI_DISSOLVE
+ applyDissolveEmission(finalEmission);
+ #endif
+
+ #ifdef POI_RIM
+ ApplyRimEmission(finalEmission);
+ #endif
+
+ #ifdef POI_FLIPBOOK
+ applyFlipbookEmission(finalEmission);
+ #endif
+
+ #ifdef POI_GLITTER
+ applyGlitter(finalEmission, finalColor);
+ #endif
+
+ #ifdef POI_MSDF
+ {
+ ApplyTextOverlayEmission(finalEmission);
+ }
+ #endif
+ #endif
+
+ #ifdef POI_LIGHTING
+ #if(defined(POINT) || defined(SPOT))
+ #ifdef POI_METAL
+ //ApplyMetallics(finalColor, true);
+ #endif
+ #endif
+ #endif
+
+ #if defined(TRANSPARENT) && defined(FORWARD_ADD_PASS)
+ finalColor.rgb *= finalColor.a;
+ #endif
+
+ #ifdef POI_VIDEO
+ applyScreenEffect(finalColor, finalColorBeforeLighting);
+ finalEmission += globalVideoEmission;
+ #endif
+
+ #ifdef POI_ALPHA_TO_COVERAGE
+ ApplyAlphaToCoverage(finalColor);
+ #endif
+
+ #ifdef CUTOUT
+ UNITY_BRANCH
+ if (_AlphaToMask == 1)
+ {
+ applyDithering(finalColor);
+ }
+ #endif
+
+ #ifdef POI_METAL
+ bool probeExists = shouldMetalHappenBeforeLighting();
+ UNITY_BRANCH
+ if(!probeExists)
+ {
+ ApplyMetallicsFake(finalColor);
+ }
+ #endif
+
+ #ifdef VERTEXLIGHT_ON
+ finalColor.rgb *= finalLighting + poiLight.vFinalLighting;
+ #else
+ finalColor.rgb *= finalLighting;
+ #endif
+
+ #ifdef POI_METAL
+ UNITY_BRANCH
+ if(probeExists)
+ {
+ ApplyMetallics(finalColor);
+ }
+ #endif
+
+ finalColor.rgb += finalSpecular0 + finalEnvironmentalRim + finalSSS;
+
+ #ifdef FORWARD_BASE_PASS
+ #ifdef POI_CLEARCOAT
+ calculateAndApplyClearCoat(finalColor);
+ #endif
+ #endif
+
+ #ifdef POI_DEBUG
+ displayDebugInfo(finalColor);
+ #endif
+
+ finalColor.a = saturate(finalColor.a);
+
+
+ #if defined(TRANSPARENT) || defined(CUTOUT)
+ //finalEmission *= finalColor.a;
+ #endif
+
+ #ifdef POI_META_PASS
+ UnityMetaInput meta;
+ UNITY_INITIALIZE_OUTPUT(UnityMetaInput, meta);
+ meta.Emission = finalEmission * _GIEmissionMultiplier;
+ meta.Albedo = saturate(finalColor.rgb);
+ #ifdef POI_SPECULAR
+ meta.SpecularColor = poiLight.color.rgb * _SpecularTint.rgb * lerp(1, albedo.rgb, _SpecularMetallic) * _SpecularTint.a;
+ #else
+ meta.SpecularColor = poiLight.color.rgb * albedo.rgb;
+ #endif
+ return UnityMetaFragment(meta);
+ #endif
+
+ finalColor.rgb += finalEmission;
+
+ #ifdef POI_GRAB
+ applyGrabEffects(finalColor);
+ #endif
+
+ #ifdef POI_BLUR
+ ApplyBlurToGrabPass(finalColor);
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, finalColor);
+ }
+ #endif
+
+ #ifdef OPAQUE
+ finalColor.a = 1;
+ #endif
+
+ #ifdef FORWARD_ADD_PASS
+ finalColor.rgb *= finalColor.a;
+ #endif
+
+ return finalColor;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFrag.cginc.meta
new file mode 100644
index 00000000..6851b7f2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f382ccade80ef23478e1bfc2033b3558
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFur.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFur.cginc
new file mode 100644
index 00000000..7f65d729
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFur.cginc
@@ -0,0 +1,40 @@
+#ifndef POI_FUR
+ #define POI_FUR
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_FurTexture); float4 _FurTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_FurHeightMap); float4 _FurHeightMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_FurMask); float4 _FurMask_ST;
+ float _FurAO;
+ float4 _FurColor;
+ float _FurLayers;
+ float _FurMinDistance;
+ float _FurMaxDistance;
+ float _FurHeightMapMin;
+ float _FurHeightMapMax;
+ float _FurDebug;
+ float _AoRampMin;
+ float _AoRampMax;
+ float _FurTipAlpha;
+ float _FurFadeStart;
+
+ //globals
+ half furHeightMap;
+ half furMask;
+
+ void calculateFur()
+ {
+
+ furHeightMap = UNITY_SAMPLE_TEX2D_SAMPLER(_FurHeightMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _FurHeightMap)).x;
+ furHeightMap = remap(furHeightMap, 0, _FurHeightMapMax, _FurHeightMapMin, 1);
+ furMask = poiMax(UNITY_SAMPLE_TEX2D_SAMPLER(_FurMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _FurMask)).xyz);
+ half3 furTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_FurTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _FurTexture));
+ clip(furHeightMap - poiMesh.furAlpha);
+ clip(furMask - poiMesh.furAlpha);
+
+ albedo.rgb = lerp(mainTexture.rgb, furTexture.rgb * _FurColor.rgb, ceil(poiMesh.furAlpha));
+ albedo.rgb *= lerp(1, smoothstep(_AoRampMin, _AoRampMax, furHeightMap), _FurAO * furMask);
+
+ albedo.a *= smoothstep(1.01, _FurTipAlpha, remapClamped(poiMesh.furAlpha, _FurFadeStart, 1, 0, 1)) + _AlphaMod;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFur.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFur.cginc.meta
new file mode 100644
index 00000000..8fd18928
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFur.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 97ee25df78398024f8529628e7b83f9d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFurCardPass.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFurCardPass.cginc
new file mode 100644
index 00000000..d7600752
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFurCardPass.cginc
@@ -0,0 +1,200 @@
+#include "UnityCG.cginc"
+#include "Lighting.cginc"
+#include "UnityPBSLighting.cginc"
+#include "AutoLight.cginc"
+
+struct appdata
+{
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float2 uv0: TEXCOORD0;
+ uint id: SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+};
+
+struct v2g
+{
+ float4 pos: SV_POSITION;
+ float2 uv0: TEXCOORD0;
+ float3 normal: TEXCOORD4;
+ float3 tangent: TEXCOORD5;
+ uint vid: TEXCOORD6;
+ float3 worldPos: TEXCOORD7;
+ float3 binormal: TEXCOORD8;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+};
+
+struct g2f
+{
+ float4 pos: SV_POSITION;
+ float4 uv: TEXCOORD0;
+ float3 worldPos: TEXCOORD1;
+ float3 normal: TEXCOORD4;
+ float3 tangent: TEXCOORD5;
+ float startToEndGradient: TEXCOORD6;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+};
+
+float3 CreateBinormal(float3 normal, float3 tangent, float binormalSign)
+{
+ return cross(normal, tangent.xyz) *
+ (binormalSign * unity_WorldTransformParams.w);
+}
+
+v2g furVert(appdata v)
+{
+ v2g o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ o.worldPos = mul(unity_ObjectToWorld, v.vertex);
+ o.pos = UnityObjectToClipPos(v.vertex);
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent.xyz);
+ o.binormal = CreateBinormal(o.normal, o.tangent, v.tangent.w);
+ o.uv0 = v.uv0.xy;
+ o.vid = v.id;
+ return o;
+}
+
+float random(float2 vids)
+{
+ return frac(sin(dot(vids, float2(12.9898, 78.2383))) * 43758.5453123);
+}
+
+sampler2D _FurCombMap; float4 _FurCombMap_ST;
+float _FurWidth;
+float _FurCardLength;
+float _FurRaised;
+
+#include "PoiMath.cginc"
+
+[maxvertexcount(6)]
+void furGeom(triangle v2g IN[3], inout TriangleStream < g2f > tristream)
+{
+ float randomValueA = random(float2(IN[0].vid + IN[2].vid, IN[2].vid + IN[0].vid));
+ float randomValueB = random(float2(IN[1].vid + IN[2].vid, IN[1].vid + IN[0].vid));
+ float randomValueC = random(float2(IN[2].vid + IN[2].vid, IN[0].vid + IN[0].vid));
+
+ float3 polySideA = IN[1].worldPos.xyz - IN[0].worldPos.xyz;
+ float3 polySideB = IN[2].worldPos.xyz - IN[0].worldPos.xyz;
+ float3 c = cross(polySideA, polySideB);
+ float3 outDir = normalize(c);
+ float3 furRootPos = float4(IN[0].worldPos.xyz + (polySideA * randomValueA) + (polySideB * randomValueB), 1);
+
+ float3 rootTangent = normalize((IN[0].tangent + IN[1].tangent + IN[2].tangent) * .3333333);
+ float3 rootNormal = normalize((IN[0].normal + IN[1].normal + IN[2].normal) * .3333333);
+ float3 rootBinormal = normalize((IN[0].binormal + IN[1].binormal + IN[2].binormal) * .3333333);
+ float3 furRight = normalize(cross(IN[0].binormal, outDir));
+ float2 rootUV = (IN[0].uv0 + IN[1].uv0 + IN[2].uv0) * .333333;
+ half3 tangentSpaceNormal = UnpackNormal(tex2Dlod(_FurCombMap, float4(TRANSFORM_TEX(rootUV, _FurCombMap), 0, 0)));
+ float3 furForward = normalize(
+ tangentSpaceNormal.x * rootTangent +
+ tangentSpaceNormal.y * rootBinormal +
+ tangentSpaceNormal.z * rootNormal
+ );
+
+ furForward = (lerp(furForward, outDir, _FurRaised));
+ //furForward = rotate_with_quaternion(furForward, float3(_FurRaised,0,0));
+
+ g2f o;
+ float4 worldPos[4];
+ float4 pos[4];
+ float4 uv[4];
+ uv[0] = float4(0, 0, rootUV);
+ uv[1] = float4(0, 1, rootUV);
+ uv[2] = float4(1, 1, rootUV);
+ uv[3] = float4(1, 0, rootUV);
+
+ _FurWidth *= .01;
+ _FurCardLength *= .01;
+
+ worldPos[3] = mul(unity_WorldToObject, float4(furRootPos + (furRight * _FurWidth) + (furForward * _FurCardLength), 1));
+ worldPos[2] = mul(unity_WorldToObject, float4(furRootPos + (furRight * _FurWidth), 1));
+ worldPos[1] = mul(unity_WorldToObject, float4(furRootPos + (-furRight * _FurWidth), 1));
+ worldPos[0] = mul(unity_WorldToObject, float4(furRootPos + (-furRight * _FurWidth) + (furForward * _FurCardLength), 1));
+
+ pos[3] = UnityObjectToClipPos(worldPos[3]);
+ pos[2] = UnityObjectToClipPos(worldPos[2]);
+ pos[1] = UnityObjectToClipPos(worldPos[1]);
+ pos[0] = UnityObjectToClipPos(worldPos[0]);
+
+ o.normal = rootNormal;
+ o.tangent = furForward;
+ o.worldPos = worldPos[0];
+ o.pos = pos[0];
+ o.uv = uv[0];
+ o.startToEndGradient = 1;
+ tristream.Append(o);
+ o.worldPos = worldPos[1];
+ o.pos = pos[1];
+ o.uv = uv[1];
+ o.startToEndGradient = 0;
+ tristream.Append(o);
+ o.worldPos = worldPos[2];
+ o.pos = pos[2];
+ o.uv = uv[2];
+ o.startToEndGradient = 0;
+ tristream.Append(o);
+
+ tristream.RestartStrip();
+ o.worldPos = worldPos[2];
+ o.pos = pos[2];
+ o.uv = uv[2];
+ o.startToEndGradient = 0;
+ tristream.Append(o);
+ o.worldPos = worldPos[3];
+ o.pos = pos[3];
+ o.uv = uv[3];
+ o.startToEndGradient = 1;
+ tristream.Append(o);
+ o.worldPos = worldPos[0];
+ o.pos = pos[0];
+ o.uv = uv[0];
+ o.startToEndGradient = 1;
+ tristream.Append(o);
+
+ tristream.RestartStrip();
+}
+
+sampler2D _FurCardTexture; float4 _FurCardTexture_ST; float4 _FurCardTexture_TexelSize;
+sampler2D _FurCardAlphaTexture; float4 _FurCardAlphaTexture_ST; float4 _FurCardAlphaTexture_TexelSize;
+sampler2D _FurPattern; float4 _FurPattern_ST;
+float _FurClip;
+fixed _FurAoStrength;
+float CalcMipLevel(float2 uv)
+{
+ float2 dx = ddx(uv * _FurCardTexture_TexelSize.zw);
+ float2 dy = ddy(uv * _FurCardTexture_TexelSize.zw);
+ float delta_max_sqr = max(dot(dx, dx), dot(dy, dy));
+
+ return max(0.0, 0.5 * log2(delta_max_sqr));
+}
+
+#include "CGI_FurLighting.cginc"
+
+void ApplyAlphaToCoverage(inout float4 finalColor, float2 uv)
+{
+ // rescale alpha by mip level (if not using preserved coverage mip maps)
+ finalColor.a *= 1 + max(0, CalcMipLevel(uv)) * .25;
+ // rescale alpha by partial derivative
+ finalColor.a = (finalColor.a - _FurClip) / fwidth(finalColor.a) + 0.5;
+}
+
+fixed4 FurFag(g2f i): SV_Target
+{
+ float3 viewDir = normalize(_WorldSpaceCameraPos - i.worldPos);
+
+ UNITY_SETUP_INSTANCE_ID(i);
+ float4 finalColor = 1;
+ finalColor.rgb = tex2D(_FurPattern, TRANSFORM_TEX(i.uv.zw, _FurPattern)).rgb;
+ finalColor.rgb *= tex2D(_FurCardTexture, TRANSFORM_TEX(i.uv.xy, _FurCardTexture)).rgb;
+ finalColor.a = tex2D(_FurCardAlphaTexture, TRANSFORM_TEX(i.uv.xy, _FurCardAlphaTexture)).r;
+ ApplyAlphaToCoverage(finalColor, i.uv.xy);
+ applyFurLighting(finalColor, i.uv, 1 /*attenuation*/, i.normal, viewDir, i.worldPos);
+ finalColor.rgb *= lerp(1, i.startToEndGradient, _FurAoStrength);
+ return finalColor;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFurCardPass.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFurCardPass.cginc.meta
new file mode 100644
index 00000000..8e74c656
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiFurCardPass.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7f984191e3c28b34c8331de0fa2698fc
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeom.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeom.cginc
new file mode 100644
index 00000000..a1d2e5d5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeom.cginc
@@ -0,0 +1,10 @@
+[maxvertexcount(3)]
+void geom(triangle v2f IN[3], inout TriangleStream < v2f > tristream)
+{
+ for (int i = 0; i < 3; i ++)
+ {
+ IN[i].uv = uv;
+ tristream.Append(IN[i]);
+ }
+ tristream.RestartStrip();
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeom.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeom.cginc.meta
new file mode 100644
index 00000000..696fb314
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeom.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8448c818130ccad43935a0a3d6186fdb
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeomFur.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeomFur.cginc
new file mode 100644
index 00000000..30e9fe8f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeomFur.cginc
@@ -0,0 +1,37 @@
+float _FurLength;
+float _FurGravityStrength;
+
+[instance(4)]
+[maxvertexcount(16)]
+void geomFur(triangle v2f IN[3], inout TriangleStream < v2f > tristream, uint InstanceID : SV_GSInstanceID)
+{
+ float4 fur_worldPos[3];
+ v2f o_fur[3];
+ float3 offset = (float3(0, -1, 0) * (_FurLength) *_FurGravityStrength);
+
+ for (int i = 0; i < 3; i++)
+ {
+ if (InstanceID == 0) {
+ IN[i].furAlpha = 0;
+ tristream.Append(IN[i]);
+ }
+ o_fur[i] = IN[i];
+ fur_worldPos[i] = float4(IN[i].worldPos + IN[i].normal * _FurLength, 1);
+ }
+ if (InstanceID == 0) {
+ tristream.RestartStrip();
+ }
+ int Total_FurLayers = clamp(floor(_FurLayers * (1 - smoothstep(_FurMinDistance, _FurMaxDistance, distance(IN[0].worldPos, getCameraPosition())))), min(1, _FurLayers), _FurLayers);
+
+ int startLayer = max(int(InstanceID) * 6 - 1, 0);
+ for (int layer = startLayer; layer < Total_FurLayers; layer++) {
+ for (int i = 0; i < 3; i++) {
+ o_fur[i].furAlpha = float(layer+1) / (Total_FurLayers+1);
+ o_fur[i].worldPos = float4(lerp(IN[i].worldPos, fur_worldPos[i] + offset * o_fur[i].furAlpha, o_fur[i].furAlpha),1);
+ o_fur[i].pos = UnityWorldToClipPos(o_fur[i].worldPos);
+ o_fur[i].furAlpha += .01;
+ tristream.Append(o_fur[i]);
+ }
+ tristream.RestartStrip();
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeomFur.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeomFur.cginc.meta
new file mode 100644
index 00000000..579f213c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGeomFur.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7fae1ecaf77bab941a2b3fd30d68e1cd
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGlitter.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGlitter.cginc
new file mode 100644
index 00000000..b6d72b0c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGlitter.cginc
@@ -0,0 +1,229 @@
+#ifndef POI_GLITTER
+ #define POI_GLITTER
+
+ half3 _GlitterColor;
+ POI_TEXTURE_NOSAMPLER(_GlitterMask);
+ float2 _GlitterPan;
+ POI_TEXTURE_NOSAMPLER(_GlitterColorMap);
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ fixed _GlitterUseSurfaceColor;
+ uint _GlitterBlendType;
+
+ float3 randomFloat3(float2 Seed, float maximum)
+ {
+ return(.5 + float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return(float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + _GlitterSpeed;
+ return float3(sin((_Time.x + rando.x * pi) * speed), sin((_Time.x + rando.y * pi) * speed), sin((_Time.x + rando.z * pi) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ float3 hsv = float3(hue, saturation, value);
+ return HSVtoRGB(hsv);
+ }
+
+ void applyGlitter(inout float3 finalEmission, inout float4 finalColor)
+ {
+
+
+ // Scale
+ float2 st = poiMesh.uv[0] * _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;
+ for (int j = -1; j <= 1; j ++)
+ {
+ for (int i = -1; i <= 1; i ++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ // 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. - step(_GlitterSize, m_dist));
+ float3 randomRotation = 0;
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+ float3 norm = poiMesh.normals[0];
+
+ float3 glitterReflectionDirection = normalize(lerp(-poiCam.viewDir, mul(poiRotationMatrixFromAngles(randomRotation), norm), glitterAlpha));
+ float3 finalGlitter = lerp(0, _GlitterMinBrightness, glitterAlpha) + max(pow(dot(lerp(glitterReflectionDirection, poiCam.viewDir, _GlitterBias), poiCam.viewDir), _GlitterContrast) * _GlitterBrightness, 0);
+ _GlitterColor *= lerp(1, finalColor, _GlitterUseSurfaceColor);
+ _GlitterColor *= POI2D_SAMPLER_PAN(_GlitterColorMap, _MainTex, poiMesh.uv[_GlitterColorMapUV], _GlitterColorMapPan);
+
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiMesh.uv[_GlitterMaskUV], _GlitterMaskPan);
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ _GlitterColor *= glitterMask;
+
+ if(_GlitterRandomColors)
+ {
+ _GlitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if(_GlitterBlendType == 0)
+ {
+ finalEmission += finalGlitter * _GlitterColor;
+ }
+ else
+ {
+ finalColor.rgb = lerp(finalColor.rgb, finalGlitter * _GlitterColor, finalGlitter);
+ }
+ // Draw grid
+ //color.r += step(.98, f_st.x) + step(.98, f_st.y);
+ }
+
+#endif
+
+
+/*
+float2 F = inoise(poiMesh.uv[0] * _GlitterFrequency, _GlitterJitter) * .7;
+float HeightMap = (F.y - F.x) * _GlitterSpeed;
+float3 normal = UnityObjectToWorldNormal(float3(0, 0, 1));
+normal = HeightToNormal(HeightMap, normal, poiMesh.worldPos);
+normal = WorldToTangentNormalfloattor(normal);
+
+//Unity_NormalFromHeight_World((HeightMap), test);
+//poiMathMagic((F.y - F.x), test);
+//test = (UnpackScaleNormal(float4(test, 1),40));
+
+test = normalize(
+ test.x * poiMesh.tangent +
+ test.y * poiMesh.binormal +
+ test.z * poiMesh.normals[0]
+);
+
+//finalColor.rgb = dot(test, -poiCam.viewDir) * _GlitterBrightness;
+finalColor.rgb = normal;
+*/
+/*
+half circleGradient;
+half3 circleColor;
+inoise(poiMesh.uv[0] * _GlitterFrequency, circleGradient, circleColor);
+half circle = 1 - pow(max(0.0, abs(circleGradient) * _GlitterSpeed - 1), 2);
+float2 P = poiMesh.uv[0] * _GlitterFrequency;
+float2 Pi = mod(floor(P), 289.0);
+float2 Pf = ceil(P) * .03;
+finalColor.rgb = circle * circleColor;
+
+void inoise(float2 P, out half cirlceGradient, out half3 circleColor)
+{
+ float2 Pi = mod(floor(P), 289.0);
+ float2 Pf = frac(P);
+ float3 oi = float3(-1.0, 0.0, 1.0);
+ float3 of = float3(-0.5, 0.5, 1.5);
+ float3 px = Permutation(Pi.x + oi);
+
+ float3 p, ox, oy, dx, dy;
+ float2 F = 1e6;
+
+ for (int i = 0; i < 3; i ++)
+ {
+ p = Permutation(px[i] + Pi.y + oi); // pi1, pi2, pi3
+ ox = frac(p * K) - Ko;
+ oy = mod(floor(p * K), 7.0) * K - Ko;
+ dx = Pf.x - of[i] + _GlitterJitter * ox;
+ dy = Pf.y - of + _GlitterJitter * oy;
+
+ float3 d = dx * dx + dy * dy; // di1, di2 and di3, squared
+
+ //find the lowest and second lowest distances
+ for (int n = 0; n < 3; n ++)
+ {
+ if (d[n] < F[0])
+ {
+ F[1] = F[0];
+ F[0] = d[n];
+ }
+ else if(d[n] < F[1])
+ {
+ F[1] = d[n];
+ }
+ }
+ }
+ circleColor = randomFloat3(Pi, 1);
+ cirlceGradient = F.x;
+}
+*/ \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGlitter.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGlitter.cginc.meta
new file mode 100644
index 00000000..23d08684
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGlitter.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 5aab04a3fc6c0c147acc353ec6dd6130
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGrab.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGrab.cginc
new file mode 100644
index 00000000..5e2c0fb2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGrab.cginc
@@ -0,0 +1,109 @@
+#ifndef POI_GRAB
+ #define POI_GRAB
+
+ float _RefractionIndex;
+ float _RefractionOpacity;
+ float _RefractionChromaticAberattion;
+ float _RefractionEnabled;
+ uint _SourceBlend, _DestinationBlend;
+ float _GrabBlurDistance;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RefractionOpacityMask); float4 _RefractionOpacityMask_ST;
+
+ inline float4 Refraction(float indexOfRefraction, float chromaticAberration, float2 projectedGrabPos)
+ {
+ float4 refractionColor;
+ float3 worldViewDir = normalize(UnityWorldSpaceViewDir(poiMesh.worldPos));
+ float3 refractionOffset = ((((indexOfRefraction - 1.0) * mul(UNITY_MATRIX_V, float4(poiMesh.normals[1], 0.0))) * (1.0 / (poiCam.grabPos.z + 1.0))) * (1.0 - dot(poiMesh.normals[1], worldViewDir)));
+ float2 cameraRefraction = float2(refractionOffset.x, - (refractionOffset.y * _ProjectionParams.x));
+ //return tex2D(_PoiGrab, (projgrabPos + cameraRefraction));
+ UNITY_BRANCH
+ if (_RefractionChromaticAberattion > 0)
+ {
+ float4 redAlpha = tex2D(_PoiGrab, (projectedGrabPos + cameraRefraction));
+ float green = tex2D(_PoiGrab, (projectedGrabPos + (cameraRefraction * (1.0 - chromaticAberration)))).g;
+ float blue = tex2D(_PoiGrab, (projectedGrabPos + (cameraRefraction * (1.0 + chromaticAberration)))).b;
+ refractionColor = float4(redAlpha.r, green, blue, redAlpha.a);
+ }
+ else
+ {
+ float2 refractedGrab = projectedGrabPos + cameraRefraction;
+ refractionColor = tex2D(_PoiGrab, (refractedGrab));
+ #ifdef CHROMATIC_ABERRATION_LOW
+ float3 offset = float3(0.0, .05, .12);
+ float3 weight = float3(0.2270270270, 0.3162162162, 0.0702702703) * .5;
+ refractionColor *= weight[0];
+
+
+ refractionColor += tex2D(_PoiGrab, refractedGrab + float2(0.0, offset.y * _GrabBlurDistance)) * weight.y;
+ refractionColor += tex2D(_PoiGrab, refractedGrab - float2(0.0, offset.y * _GrabBlurDistance)) * weight.y;
+ refractionColor += tex2D(_PoiGrab, refractedGrab + float2(0.0, offset.z * _GrabBlurDistance)) * weight.z;
+ refractionColor += tex2D(_PoiGrab, refractedGrab - float2(0.0, offset.z * _GrabBlurDistance)) * weight.z;
+ refractionColor += tex2D(_PoiGrab, refractedGrab + float2(offset.y * _GrabBlurDistance, 0.0)) * weight.y;
+ refractionColor += tex2D(_PoiGrab, refractedGrab - float2(offset.y * _GrabBlurDistance, 0.0)) * weight.y;
+ refractionColor += tex2D(_PoiGrab, refractedGrab + float2(offset.z * _GrabBlurDistance, 0.0)) * weight.z;
+ refractionColor += tex2D(_PoiGrab, refractedGrab - float2(offset.z * _GrabBlurDistance, 0.0)) * weight.z;
+
+ #endif
+ }
+ return refractionColor;
+ }
+
+ void calculateRefraction(float2 projectedGrabPos, inout float4 finalColor)
+ {
+ float3 refraction = 1;
+ UNITY_BRANCH
+ if(_RefractionEnabled == 1)
+ {
+ refraction = Refraction(_RefractionIndex, _RefractionChromaticAberattion, projectedGrabPos).rgb;
+ }
+ else
+ {
+ refraction = tex2Dproj(_PoiGrab, poiCam.grabPos);
+
+ #ifdef CHROMATIC_ABERRATION_LOW
+ float3 offset = float3(0.0, .05, .12);
+ float3 weight = float3(0.2270270270, 0.3162162162, 0.0702702703) * .5;
+ refraction *= weight[0];
+
+
+ refraction += tex2D(_PoiGrab, projectedGrabPos + float2(0.0, offset.y * _GrabBlurDistance)) * weight.y;
+ refraction += tex2D(_PoiGrab, projectedGrabPos - float2(0.0, offset.y * _GrabBlurDistance)) * weight.y;
+ refraction += tex2D(_PoiGrab, projectedGrabPos + float2(0.0, offset.z * _GrabBlurDistance)) * weight.z;
+ refraction += tex2D(_PoiGrab, projectedGrabPos - float2(0.0, offset.z * _GrabBlurDistance)) * weight.z;
+ refraction += tex2D(_PoiGrab, projectedGrabPos + float2(offset.y * _GrabBlurDistance, 0.0)) * weight.y;
+ refraction += tex2D(_PoiGrab, projectedGrabPos - float2(offset.y * _GrabBlurDistance, 0.0)) * weight.y;
+ refraction += tex2D(_PoiGrab, projectedGrabPos + float2(offset.z * _GrabBlurDistance, 0.0)) * weight.z;
+ refraction += tex2D(_PoiGrab, projectedGrabPos - float2(offset.z * _GrabBlurDistance, 0.0)) * weight.z;
+
+ #endif
+ }
+
+ finalColor.a *= alphaMask;
+ finalColor = poiBlend(_SourceBlend, finalColor, _DestinationBlend, float4(refraction, 1));
+ finalColor.a = 1;
+ }
+
+ float2 calculateGrabPosition()
+ {
+ float4 grabPos = poiCam.grabPos;
+ #if UNITY_UV_STARTS_AT_TOP
+ float scale = -1.0;
+ #else
+ float scale = 1.0;
+ #endif
+ float halfPosW = grabPos.w * 0.5;
+ grabPos.y = (grabPos.y - halfPosW) * _ProjectionParams.x * scale + halfPosW;
+ #if SHADER_API_D3D9 || SHADER_API_D3D11
+ grabPos.w += 0.00000000001;
+ #endif
+ return(grabPos / grabPos.w).xy;
+ }
+
+ void applyGrabEffects(inout float4 finalColor)
+ {
+ float2 projectedGrabPos = calculateGrabPosition();
+ calculateRefraction(projectedGrabPos, finalColor);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGrab.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGrab.cginc.meta
new file mode 100644
index 00000000..56059849
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiGrab.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 805b20bfecdd38d42b11d4234fe29dd5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHelpers.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHelpers.cginc
new file mode 100644
index 00000000..179a2a46
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHelpers.cginc
@@ -0,0 +1,294 @@
+#ifndef POI_HELPER
+ #define POI_HELPER
+
+ #include "CGI_PoiColors.cginc"
+
+ #ifndef pi
+ #define pi float(3.14159265359)
+ #endif
+
+ 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(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 mod(float3 x, float y)
+ {
+ return x - y * floor(x / y);
+ }
+ float2 mod(float2 x, float y)
+ {
+ return x - y * floor(x / y);
+ }
+
+ //1/7
+ #define K 0.142857142857
+ //3/7
+ #define Ko 0.428571428571
+
+ // Permutation polynomial: (34x^2 + x) mod 289
+ float3 Permutation(float3 x)
+ {
+ return mod((34.0 * x + 1.0) * x, 289.0);
+ }
+
+ bool IsInMirror()
+ {
+ return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f;
+ }
+
+ float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax)
+ {
+ #if UNITY_SPECCUBE_BOX_PROJECTION
+ UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax: boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition);
+ }
+ #endif
+ return direction;
+ }
+
+ // Camera
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1));
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ float3 grayscale_vector_node()
+ {
+ return float3(0, 0.3823529, 0.01845836);
+ }
+
+ float3 grayscale_for_light()
+ {
+ return float3(0.298912, 0.586611, 0.114478);
+ }
+
+ //Math Operators
+
+ float remap(float x, float minOld, float maxOld, float minNew, float maxNew)
+ {
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+ }
+
+ float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew)
+ {
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+ }
+
+ float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew)
+ {
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+ }
+
+ float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew)
+ {
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+ }
+
+ float remapClamped(float x, float minOld, float maxOld, float minNew, float maxNew)
+ {
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+ }
+
+ float2 remapClamped(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew)
+ {
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+ }
+
+ float3 remapClamped(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew)
+ {
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+ }
+
+ float4 remapClamped(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew)
+ {
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+ }
+
+ 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);
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+#endif
+
+half2 calcScreenUVs(half4 grabPos)
+{
+ half2 uv = grabPos / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #else
+ uv.xy *= _ScreenParams.xy;
+ #endif
+
+ return uv;
+}
+
+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);
+}
+
+// Dithering
+inline half Dither8x8Bayer(int x, int y)
+{
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+}
+
+// UV Manipulation
+float2 TransformUV(half2 offset, half rotation, half2 scale, float2 uv)
+{
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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));
+}
+
+float3 hueShift(float3 col, float hueAdjust)
+{
+ hueAdjust *= 2 * pi;
+ const float3 k = float3(0.57735, 0.57735, 0.57735);
+ half cosAngle = cos(hueAdjust);
+ return col * cosAngle + cross(k, col) * sin(hueAdjust) + k * dot(k, col) * (1.0 - cosAngle);
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHelpers.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHelpers.cginc.meta
new file mode 100644
index 00000000..bd35b08d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHelpers.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e21350293a29ca54eafcd03b2fc25bb4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHologram.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHologram.cginc
new file mode 100644
index 00000000..c54f70d4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHologram.cginc
@@ -0,0 +1,36 @@
+#ifndef POI_HOLOGRAM
+ #define POI_HOLOGRAM
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_HoloAlphaMap); float4 _HoloAlphaMap_ST;
+ uint _HoloCoordinateSpace; // 0 World, 1 Local, 2 UV
+ float3 _HoloDirection;
+ float _HoloScrollSpeed;
+ float _HoloLineDensity;
+
+ fixed _HoloFresnelAlpha;
+ fixed _HoloRimSharpness;
+ fixed _HoloRimWidth;
+ void ApplyHoloAlpha(inout float4 color)
+ {
+ float uv = 0;
+ UNITY_BRANCH
+ if (_HoloCoordinateSpace == 0)
+ {
+ uv = dot(normalize(_HoloDirection), poiMesh.worldPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ UNITY_BRANCH
+ if(_HoloCoordinateSpace == 1)
+ {
+ uv = dot(normalize(_HoloDirection), poiMesh.localPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ UNITY_BRANCH
+ if(_HoloCoordinateSpace == 2)
+ {
+ uv = dot(_HoloDirection, poiMesh.uv[0] * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ float holoRim = saturate(1 - smoothstep(min(_HoloRimSharpness, _HoloRimWidth), _HoloRimWidth, poiCam.viewDotNormal));
+ holoRim = abs(lerp(1, holoRim, _HoloFresnelAlpha));
+ color.a *= UNITY_SAMPLE_TEX2D_SAMPLER(_HoloAlphaMap, _MainTex, uv).r * holoRim;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHologram.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHologram.cginc.meta
new file mode 100644
index 00000000..ecb568d1
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiHologram.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ace38b63cbeedcf478b5e4ef59929a53
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiIridescence.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiIridescence.cginc
new file mode 100644
index 00000000..47d5624f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiIridescence.cginc
@@ -0,0 +1,61 @@
+#ifndef POI_IRIDESCENCE
+ #define POI_IRIDESCENCE
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceRamp); float4 _IridescenceRamp_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceMask); float4 _IridescenceMask_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceNormalMap); float4 _IridescenceNormalMap_ST;
+ uint _IridescenceNormalUV;
+ uint _IridescenceMaskUV;
+ uint _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceIntensity;
+ fixed _IridescenceAddBlend;
+ fixed _IridescenceReplaceBlend;
+ fixed _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ //global
+
+ float3 calculateNormal(float3 baseNormal)
+ {
+ float3 normal = UnpackScaleNormal(UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceNormalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[_IridescenceNormalUV], _IridescenceNormalMap)), _IridescenceNormalIntensity);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ normal.z * baseNormal
+ );
+ }
+
+ float3 applyIridescence(inout float4 albedo)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+
+ // Use custom normal map
+ UNITY_BRANCH
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(normal);
+ }
+
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, 1 - abs(ndotv));
+ float4 iridescenceMask = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask));
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+
+ albedo.rgb = lerp(albedo.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ albedo.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ albedo.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ return saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * _IridescenceEmissionStrength;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiIridescence.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiIridescence.cginc.meta
new file mode 100644
index 00000000..d3adc2f9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiIridescence.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0b6492eb757fd864da77959d6807565e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiLighting.cginc
new file mode 100644
index 00000000..37feb5cc
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiLighting.cginc
@@ -0,0 +1,409 @@
+
+#ifndef POI_LIGHTING
+ #define POI_LIGHTING
+
+ int _LightingType;
+ float _ForceLightDirection;
+ float _ShadowStrength;
+ float _OutlineShadowStrength;
+ float _ShadowOffset;
+ float3 _LightDirection;
+ float _ForceShadowStrength;
+ float _CastedShadowSmoothing;
+ float _LightingIndirectContribution;
+ float _AttenuationMultiplier;
+ float _EnableLighting;
+ float _LightingControlledUseLightColor;
+ fixed _LightingStandardSmoothness;
+ fixed _LightingStandardControlsToon;
+ fixed _LightingMinLightBrightness;
+ float _LightingUseShadowRamp;
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ fixed _LightingMonochromatic;
+
+ uint _LightingNumRamps;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ToonRamp1);
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ToonRamp2);
+ half _LightingShadowStrength1;
+ half _LightingShadowStrength2;
+ half _ShadowOffset1;
+ half _ShadowOffset2;
+
+ fixed _LightingGradientStart;
+ fixed _LightingGradientEnd;
+ float3 _LightingStartColor;
+ float3 _LightingEndColor;
+ float _AOStrength;
+ fixed _LightingDetailStrength;
+ fixed _LightingAdditiveDetailStrength;
+ fixed _LightingNoIndirectMultiplier;
+ fixed _LightingNoIndirectThreshold;
+
+ uint _LightingAdditiveType;
+ fixed _LightingAdditiveGradientStart;
+ fixed _LightingAdditiveGradientEnd;
+ fixed _LightingAdditivePassthrough;
+ /*
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ToonRamp3);
+ half _LightingShadowStrength3;
+ half _ShadowOffset3;
+ */
+
+ POI_TEXTURE_NOSAMPLER(_LightingDetailShadows);
+ POI_TEXTURE_NOSAMPLER(_LightingAOTex);
+ POI_TEXTURE_NOSAMPLER(_LightingShadowMask);
+
+ /*
+ * Standard stuff Start
+ */
+ UnityLight CreateLight(float3 normal)
+ {
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+ light.ndotl = DotClamped(normal, poiLight.direction);
+ return light;
+ }
+
+ float FadeShadows(float attenuation)
+ {
+ #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 = lerp(1, poiLight.attenuation, _AttenuationMultiplier);
+ #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)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ indirectLight.diffuse = min(subtractedLight, indirectLight.diffuse);
+ #endif
+ }
+
+ UnityIndirect CreateIndirectLight(float3 normal)
+ {
+ UnityIndirect indirectLight;
+ indirectLight.diffuse = 0;
+ indirectLight.specular = 0;
+
+ #if defined(FORWARD_BASE_PASS)
+ #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, normal
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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, normal
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(normal, 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1)));
+ #endif
+ #endif
+
+ float3 reflectionDir = reflect(-poiCam.viewDir, normal);
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = 1 - _LightingStandardSmoothness;
+ envData.reflUVW = BoxProjection(
+ reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube0_ProbePosition,
+ unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax
+ );
+ float3 probe0 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData
+ );
+ envData.reflUVW = BoxProjection(
+ reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax
+ );
+ #if UNITY_SPECCUBE_BLENDING
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ float3 probe1 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0),
+ unity_SpecCube0_HDR, envData
+ );
+ indirectLight.specular = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ indirectLight.specular = probe0;
+ }
+ #else
+ indirectLight.specular = probe0;
+ #endif
+
+ float occlusion = lerp(1, POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[_LightingAOTexUV], _LightingAOTexPan), _AOStrength);
+
+ indirectLight.diffuse *= occlusion;
+ indirectLight.diffuse = max(indirectLight.diffuse, _LightingMinLightBrightness);
+ indirectLight.specular *= occlusion;
+ #endif
+
+ return indirectLight;
+ }
+
+ /*
+ * Standard stuff End
+ */
+
+ half PoiDiffuse(half NdotV, half NdotL, half LdotH)
+ {
+ half fd90 = 0.5 + 2 * LdotH * LdotH * SmoothnessToPerceptualRoughness(.5);
+ // Two schlick fresnel term
+ half lightScatter = (1 + (fd90 - 1) * Pow5(1 - NdotL));
+ half viewScatter = (1 + (fd90 - 1) * Pow5(1 - NdotV));
+
+ return lightScatter * viewScatter;
+ }
+
+ float3 ShadeSH9Indirect()
+ {
+ return ShadeSH9(half4(0.0, -1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Direct()
+ {
+ return ShadeSH9(half4(0.0, 1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Normal(float3 normalDirection)
+ {
+ return ShadeSH9(half4(normalDirection, 1.0));
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ x1.b = length(unity_SHBb);
+ return x + x1;
+ }
+
+ float3 calculateRealisticLighting(float4 colorToLight)
+ {
+ return UNITY_BRDF_PBS(1, 0, 0, _LightingStandardSmoothness,
+ poiMesh.normals[1], poiCam.viewDir, CreateLight(poiMesh.normals[1]), CreateIndirectLight(poiMesh.normals[1]));
+ }
+
+ void calculateBasePassLighting()
+ {
+ #ifdef SIMPLE
+ _LightingType = 1;
+ _LightingIndirectContribution = 0.2;
+ #endif
+ float AOMap = 1;
+ float3 lightColor = poiLight.color;
+ #ifndef OUTLINE
+ AOMap = POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[_LightingAOTexUV], _LightingAOTexPan);
+
+ #ifdef FORWARD_BASE_PASS
+ //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 magic = saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 normalLight = saturate(_LightColor0.rgb);
+ lightColor = saturate(magic * lerp(1, AOMap, _AOStrength) + normalLight);
+ #endif
+ #endif
+
+ float3 grayscale_vector = float3(.33333, .33333, .33333);
+ float3 ShadeSH9Plus = GetSHLength();
+ float3 ShadeSH9Minus = ShadeSH9(float4(0, 0, 0, 1));
+ poiLight.directLighting = saturate(lerp(ShadeSH9Plus, lightColor, 1 - _LightingIndirectContribution));
+ poiLight.indirectLighting = saturate(ShadeSH9Minus);
+
+ float3 directLighting = lerp(poiLight.directLighting, dot(poiLight.directLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+ float3 indirectLighting = lerp(poiLight.indirectLighting, dot(poiLight.indirectLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+
+ if (max(max(indirectLighting.x, indirectLighting.y), indirectLighting.z) <= _LightingNoIndirectThreshold && max(max(directLighting.x, directLighting.y), directLighting.z) >= 0)
+ {
+ indirectLighting = directLighting * _LightingNoIndirectMultiplier;
+ }
+
+ half4 shadowStrength = 1;
+ #ifndef OUTLINE
+ #ifndef SIMPLE
+ shadowStrength = POI2D_SAMPLER_PAN(_LightingShadowMask, _MainTex, poiMesh.uv[_LightingShadowMaskUV], _LightingShadowMaskPan);
+ #endif
+ shadowStrength *= half4(_ShadowStrength, _LightingShadowStrength1, _LightingShadowStrength2, 0);
+ #else
+ shadowStrength = _OutlineShadowStrength;
+ #endif
+
+ float bw_lightColor = dot(lightColor, grayscale_vector);
+ float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, _AttenuationMultiplier)) + dot(ShadeSH9Normal(poiMesh.normals[1]), grayscale_vector));
+ float bw_bottomIndirectLighting = dot(ShadeSH9Minus, grayscale_vector);
+ float bw_topIndirectLighting = dot(ShadeSH9Plus, grayscale_vector);
+ float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting);
+
+ fixed detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingDetailStrength).r;
+ poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting);
+ poiLight.lightMap *= detailShadow;
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset), shadowStrength.r);
+
+ UNITY_BRANCH
+ if(_LightingNumRamps >= 2)
+ {
+ poiLight.rampedLightMap *= lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_ToonRamp1, _ToonRamp, poiLight.lightMap + _ShadowOffset1), shadowStrength.g);
+ }
+ UNITY_BRANCH
+ if(_LightingNumRamps >= 3)
+ {
+ poiLight.rampedLightMap *= lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_ToonRamp2, _ToonRamp, poiLight.lightMap + _ShadowOffset2), shadowStrength.b);
+ }
+
+ UNITY_BRANCH
+ if(_LightingStandardControlsToon)
+ {
+ float3 realisticLighting = calculateRealisticLighting(1);
+ poiLight.rampedLightMap = UNITY_SAMPLE_TEX2D(_ToonRamp, (.5 + dot(realisticLighting, float3(.33333, .33333, .33333)) * .5) + _ShadowOffset);
+ return;
+ }
+
+ UNITY_BRANCH
+ if(_LightingType == 0)
+ {
+ poiLight.finalLighting = lerp(indirectLighting * lerp(1, AOMap, _AOStrength), directLighting, poiLight.rampedLightMap);
+ }
+ UNITY_BRANCH
+ if(_LightingType == 1)
+ {
+ poiLight.finalLighting = lerp(poiLight.rampedLightMap * directLighting * lerp(1, AOMap, _AOStrength), directLighting, poiLight.rampedLightMap);
+ }
+ UNITY_BRANCH
+ if(_LightingType == 3)
+ {
+ poiLight.finalLighting = lerp(saturate(directLighting * _LightingStartColor), saturate(indirectLighting * _LightingEndColor * lerp(1, AOMap, _AOStrength)), smoothstep(_LightingGradientStart, _LightingGradientEnd, 1 - poiLight.lightMap));
+ }
+ }
+
+ float3 calculateNonImportantLighting(float attenuation, float attenuationDotNL, float3 albedo, float3 lightColor, half dotNL)
+ {
+ UNITY_BRANCH
+ if(_LightingAdditiveType == 0)
+ {
+ return lightColor * attenuationDotNL;
+ }
+ else
+ {
+ fixed detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingAdditiveDetailStrength).r;
+ return lerp(lightColor * attenuation, lightColor * _LightingAdditivePassthrough * attenuation, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, dotNL)) * detailShadow;
+ }
+ }
+
+ float3 calculateLighting(float3 albedo)
+ {
+ #ifdef SIMPLE
+ _LightingType = 1;
+ #endif
+ #ifdef FORWARD_BASE_PASS
+ calculateBasePassLighting();
+
+ #ifdef VERTEXLIGHT_ON
+ poiLight.vFinalLighting = 0;
+
+ for (int index = 0; index < 4; index ++)
+ {
+ poiLight.vFinalLighting += calculateNonImportantLighting(poiLight.vAttenuation[index], poiLight.vAttenuationDotNL[index], albedo, poiLight.vColor[index], poiLight.vCorrectedDotNL[index]);
+ }
+ #endif
+ #else
+ #if defined(POINT) || defined(SPOT)
+ #ifndef SIMPLE
+ fixed detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingAdditiveDetailStrength).r;
+ UNITY_BRANCH
+ if(_LightingAdditiveType == 0)
+ {
+ return poiLight.color * poiLight.attenuation * max(0, poiLight.nDotL) * detailShadow;
+ }
+ else
+ {
+ return lerp(poiLight.color * max(poiLight.additiveShadow, _LightingAdditivePassthrough), poiLight.color * _LightingAdditivePassthrough, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * detailShadow;
+ }
+ #else
+ poiLight.finalLighting = poiLight.color * poiLight.attenuation;
+ #endif
+ #endif
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if(_LightingType == 2)
+ {
+ float3 realisticLighting = calculateRealisticLighting(finalColor).rgb;
+ return lerp(realisticLighting, dot(realisticLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+ }
+ else
+ {
+ return max(poiLight.finalLighting, _LightingMinLightBrightness);
+ }
+ #else
+ return max(poiLight.finalLighting, _LightingMinLightBrightness);
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiLighting.cginc.meta
new file mode 100644
index 00000000..0cced9ff
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0e36c7fcdc698ed4daa0a2d53af5cf77
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMSDF.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMSDF.cginc
new file mode 100644
index 00000000..1644edee
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMSDF.cginc
@@ -0,0 +1,235 @@
+#ifndef POI_MSDF
+ #define POI_MSDF
+
+ sampler2D _TextGlyphs; float4 _TextGlyphs_ST; float4 _TextGlyphs_TexelSize;
+ uint _TextFPSUV, _TextTimeUV, _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled, _TextPositionEnabled, _TextTimeEnabled;
+
+
+ float4 _TextFPSColor;
+ half _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ half2 _TextFPSOffset, _TextFPSScale;
+ half _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ half _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ half2 _TextPositionOffset, _TextPositionScale;
+ half _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ half _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ half2 _TextTimeOffset, _TextTimeScale;
+ half _TextTimeRotation;
+
+ #define glyphWidth 0.0625
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+
+ float3 globalTextEmission;
+
+ half2 getAsciiCoordinate(float index)
+ {
+ return half2((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 float4 albedo, float2 uv)
+ {
+ float3 cameraPos = clamp(getCameraPosition(), -999, 999);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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);
+ half2 glyphPos = getAsciiCoordinate(positionArray[currentCharacter]);
+
+ float2 startUV = float2(1 / totalCharacters * currentCharacter, 0);
+ float2 endUV = float2(1 / totalCharacters * (currentCharacter + 1), 1);
+
+ _TextPositionPadding *= 1 / totalCharacters;
+ uv = remapClamped(uv, startUV, endUV, 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ albedo.rgb = lerp(albedo.rgb, _TextPositionColor.rgb, opacity * _TextPositionColor.a);
+ globalTextEmission += _TextPositionColor.rgb * opacity * _TextPositionEmissionStrength;
+ }
+
+ void ApplyTimeText(inout float4 albedo, float2 uv)
+ {
+ float instanceTime = _Time.y;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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);
+ half2 glyphPos = getAsciiCoordinate(timeArray[currentCharacter]);
+ // 0.1428571 = 1/7 = 1 / totalCharacters
+ float startUV = 1 / totalCharacters * currentCharacter;
+ float endUV = 1 / totalCharacters * (currentCharacter + 1);
+ _TextTimePadding *= 1 / totalCharacters;
+ uv = remapClamped(uv, float2(startUV, 0), float2(endUV, 1), 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ albedo.rgb = lerp(albedo.rgb, _TextTimeColor.rgb, opacity * _TextTimeColor.a);
+ globalTextEmission += _TextTimeColor.rgb * opacity * _TextTimeEmissionStrength;
+ }
+
+ void ApplyFPSText(inout float4 albedo, float2 uv)
+ {
+ float smoothDeltaTime = clamp(unity_DeltaTime.w, 0, 999);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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);
+ half2 glyphPos = getAsciiCoordinate(fpsArray[currentCharacter]);
+ // 0.1428571 = 1/7 = 1 / totalCharacters
+ float startUV = 1 / totalCharacters * currentCharacter;
+ float endUV = 1 / totalCharacters * (currentCharacter + 1);
+ _TextFPSPadding *= 1 / totalCharacters;
+ uv = remapClamped(uv, float2(startUV, 0), float2(endUV, 1), 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ albedo.rgb = lerp(albedo.rgb, _TextFPSColor.rgb, opacity * _TextFPSColor.a);
+ globalTextEmission += _TextFPSColor.rgb * opacity * _TextFPSEmissionStrength;
+ }
+
+ void ApplyTextOverlayColor(inout float4 albedo)
+ {
+ globalTextEmission = 0;
+ half positionalOpacity = 0;
+ #ifdef EFFECT_BUMP
+ UNITY_BRANCH
+ if(_TextFPSEnabled)
+ {
+ ApplyFPSText(albedo, poiMesh.uv[_TextFPSUV]);
+ }
+ UNITY_BRANCH
+ if(_TextPositionEnabled)
+ {
+ ApplyPositionText(albedo, poiMesh.uv[_TextPositionUV]);
+ }
+ UNITY_BRANCH
+ if(_TextTimeEnabled)
+ {
+ ApplyTimeText(albedo, poiMesh.uv[_TextTimeUV]);
+ }
+ #endif
+ }
+
+ void ApplyTextOverlayEmission(inout float3 emission)
+ {
+ emission += globalTextEmission;
+ }
+
+
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMSDF.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMSDF.cginc.meta
new file mode 100644
index 00000000..8a60811f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMSDF.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 05c0700729e307d498fe48162f958f41
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMacros.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMacros.cginc
new file mode 100644
index 00000000..50a621fd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMacros.cginc
@@ -0,0 +1,29 @@
+#ifndef POI_MACROS
+ #define POI_MACROS
+
+ #define POI_TEXTURE_NOSAMPLER(tex) Texture2D tex; float4 tex##_ST; float2 tex##Pan; uint tex##UV
+
+ #define POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, TRANSFORM_TEX(uv, tex) + _Time.x * pan))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, TRANSFORM_TEX(uv, tex)))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, TRANSFORM_TEX(uv, tex) + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, TRANSFORM_TEX(uv, tex)))
+
+ #ifdef POINT
+ # define POI_LIGHT_ATTENUATION(destName, shadow, input, worldPos) \
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1)).xyz; \
+ fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \
+ fixed destName = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ #if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS)
+ #define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1))
+ #else
+ #define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = input._LightCoord
+ #endif
+ # define POI_LIGHT_ATTENUATION(destName, shadow, input, worldPos) \
+ DECLARE_LIGHT_COORD(input, worldPos); \
+ fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \
+ fixed destName = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMacros.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMacros.cginc.meta
new file mode 100644
index 00000000..a14f6c3e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMacros.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 615413f5f663d074297d4b5630dbefd0
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMainTex.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMainTex.cginc
new file mode 100644
index 00000000..3e0f0a75
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMainTex.cginc
@@ -0,0 +1,159 @@
+#ifndef POI_MAINTEXTURE
+ #define POI_MAINTEXTURE
+
+ float2 _MainTexPan;
+ uint _MainTextureUV;
+ POI_TEXTURE_NOSAMPLER(_BumpMap);
+ POI_TEXTURE_NOSAMPLER(_AlphaMask);
+ POI_TEXTURE_NOSAMPLER(_DetailMask);
+ POI_TEXTURE_NOSAMPLER(_DetailNormalMap);
+ POI_TEXTURE_NOSAMPLER(_DetailTex);
+ POI_TEXTURE_NOSAMPLER(_MainFadeTexture);
+ POI_TEXTURE_NOSAMPLER(_MainHueShiftMask);
+ float4 _Color;
+ float _MainVertexColoring;
+ float _Saturation;
+ float _BumpScale;
+ float _DetailNormalMapScale;
+ float2 _MainDistanceFade;
+ half _MainMinAlpha;
+ half _DetailTexIntensity;
+ half3 _DetailTint;
+ float _DetailBrightness;
+ float _MainHueShiftToggle;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _MainHueShiftReplace;
+ //globals
+ float alphaMask;
+ half3 diffColor;
+
+ #include "CGI_PoiBackFace.cginc"
+
+ float3 wireframeEmission;
+
+ inline FragmentCommonData SpecularSetup(float4 i_tex)
+ {
+ half4 specGloss = 0;
+ half3 specColor = specGloss.rgb;
+ half smoothness = specGloss.a;
+
+ half oneMinusReflectivity;
+ diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specColor, /*out*/ oneMinusReflectivity);
+
+ FragmentCommonData o = (FragmentCommonData)0;
+ o.diffColor = diffColor;
+ o.specColor = specColor;
+ o.oneMinusReflectivity = oneMinusReflectivity;
+ o.smoothness = smoothness;
+ return o;
+ }
+
+ inline FragmentCommonData FragmentSetup(float4 i_tex, half3 i_viewDirForParallax, float3 i_posWorld)
+ {
+ i_tex = i_tex;
+
+ FragmentCommonData o = SpecularSetup(i_tex);
+ o.normalWorld = float4(0, 0, 0, 1);
+ o.eyeVec = poiCam.viewDir;
+ o.posWorld = i_posWorld;
+
+ // NOTE: shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha)
+ o.diffColor = PreMultiplyAlpha(o.diffColor, 1, o.oneMinusReflectivity, /*out*/ o.alpha);
+ return o;
+ }
+
+ void initTextureData()
+ {
+ mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[_MainTextureUV], _MainTex) + _Time.x * _MainTexPan);
+
+ #if (defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #ifdef POI_MIRROR
+ applyMirrorTexture();
+ #endif
+ #endif
+
+
+ #ifndef SIMPLE
+ alphaMask = POI2D_SAMPLER_PAN(_AlphaMask, _MainTex, poiMesh.uv[_AlphaMaskUV], _AlphaMaskPan);
+ #else
+ alphaMask = 1;
+ #endif
+
+ mainTexture.a *= alphaMask;
+
+ #ifndef POI_SHADOW
+ albedo = float4(lerp(mainTexture.rgb, dot(mainTexture.rgb, float3(0.3, 0.59, 0.11)), -_Saturation) * _Color.rgb * lerp(1, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoring), mainTexture.a * _Color.a);
+
+ #ifdef POI_RGBMASK
+ albedo.rgb = calculateRGBMask(albedo.rgb);
+ #endif
+
+ albedo.a = saturate(_AlphaMod + albedo.a);
+
+ wireframeEmission = 0;
+ #ifdef POI_WIREFRAME
+ applyWireframe(wireframeEmission, albedo);
+ #endif
+
+ applyBackFaceTexture();
+
+ #ifdef POI_FUR
+ calculateFur();
+ #endif
+
+ UNITY_BRANCH
+ if(_MainHueShiftToggle)
+ {
+ float hueShiftAlpha = POI2D_SAMPLER_PAN(_MainHueShiftMask, _MainTex, poiMesh.uv[_MainHueShiftMaskUV], _MainHueShiftMaskPan).r;
+
+ if(_MainHueShiftReplace)
+ {
+ albedo.rgb = lerp(albedo.rgb, hueShift(albedo.rgb, _MainHueShift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha);
+ }
+ else
+ {
+ albedo.rgb = hueShift(albedo.rgb, frac((_MainHueShift - (1 - hueShiftAlpha) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+
+ half3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiMesh.uv[_BumpMapUV], _BumpMapPan), _BumpScale);
+ half3 detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiMesh.uv[_DetailMaskUV], _DetailMaskPan);
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiMesh.uv[_DetailNormalMapUV], _DetailNormalMapPan), _DetailNormalMapScale * detailMask.g);
+ poiMesh.tangentSpaceNormal = poiMesh.tangentSpaceNormal = BlendNormals(mainNormal, detailNormal);
+
+ //float4 detailTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DetailTex, _MainTex, TRANSFORM_TEX(poiMesh.uv[_DetailTexUV], _DetailTex) + _Time.x * _DetailTexPan);
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiMesh.uv[_DetailTexUV], _DetailTexPan).rgb * _DetailTint.rgb;
+ albedo.rgb *= LerpWhiteTo(detailTexture * _DetailBrightness * unity_ColorSpaceDouble.rgb, detailMask.r * _DetailTexIntensity);
+ albedo.rgb = saturate(albedo.rgb);
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ poiCam.viewDotNormal = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+
+ #ifdef POI_HOLOGRAM
+ ApplyHoloAlpha(albedo);
+ #endif
+
+ s = FragmentSetup(float4(poiMesh.uv[0], 1, 1), poiCam.viewDir, poiMesh.worldPos);
+ #endif
+
+ #ifdef DISTORT
+ calculateDissolve();
+ #endif
+ }
+
+ void distanceFade()
+ {
+ half fadeMap = POI2D_SAMPLER_PAN(_MainFadeTexture, _MainTex, poiMesh.uv[_MainFadeTextureUV], _MainFadeTexturePan);
+ if (fadeMap)
+ {
+ half fadeValue = max(smoothstep(_MainDistanceFade.x, _MainDistanceFade.y, poiCam.distanceToVert), _MainMinAlpha);
+ albedo.a *= fadeValue;
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMainTex.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMainTex.cginc.meta
new file mode 100644
index 00000000..05276c30
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMainTex.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 239f19116716b0d4cb7fffbb0254f209
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMatcap.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMatcap.cginc
new file mode 100644
index 00000000..a9c16f1b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMatcap.cginc
@@ -0,0 +1,105 @@
+#ifndef MATCAP
+ #define MATCAP
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap);
+ POI_TEXTURE_NOSAMPLER(_MatcapMask);
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ uint _MatcapNormal;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap2);
+ POI_TEXTURE_NOSAMPLER(_Matcap2Mask);
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ uint _Matcap2Normal;
+
+ void blendMatcap(inout float4 finalColor, float add, float multiply, float replace, float4 matcapColor, float matcapMask, inout float3 matcapEmission, float emissionStrength
+ #ifdef POI_LIGHTING
+ ,float matcapLightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ ,uint blackLightMaskIndex
+ #endif
+ )
+ {
+ #ifdef POI_LIGHTING
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #endif
+ #ifdef POI_BLACKLIGHT
+ if(blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #endif
+
+ finalColor.rgb = lerp(finalColor.rgb, matcapColor.rgb, replace * matcapMask * matcapColor.a);
+ finalColor.rgb *= lerp(1, matcapColor.rgb, multiply * matcapMask * matcapColor.a);
+ finalColor.rgb += matcapColor.rgb * add * matcapMask * matcapColor.a;
+ matcapEmission += matcapColor.rgb * emissionStrength * matcapMask * matcapColor.a;
+ }
+
+ float3 applyMatcap(inout float4 finalColor)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float3 matcapEmission = 0;
+
+ // Both matcaps use the same coordinates
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+
+ // Matcap 1
+ half2 matcapUV = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, matcapUV) * _MatcapColor;
+ matcap.rgb *= _MatcapIntensity;
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiMesh.uv[_MatcapMaskUV], _MatcapMaskPan);
+ blendMatcap(finalColor, _MatcapAdd, _MatcapMultiply, _MatcapReplace, matcap, matcapMask, matcapEmission, _MatcapEmissionStrength
+ #ifdef POI_LIGHTING
+ ,_MatcapLightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ ,_BlackLightMaskMatcap
+ #endif
+ );
+
+ // Matcap 2
+ UNITY_BRANCH
+ if (_Matcap2Enable)
+ {
+ half2 matcapUV2 = half2(dot(worldViewRight, poiMesh.normals[_Matcap2Normal]), dot(worldViewUp, poiMesh.normals[_Matcap2Normal])) * _Matcap2Border + 0.5;
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, matcapUV2) * _Matcap2Color;
+ matcap2.rgb *= _Matcap2Intensity;
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiMesh.uv[_Matcap2MaskUV], _Matcap2MaskPan);
+ blendMatcap(finalColor, _Matcap2Add, _Matcap2Multiply, _Matcap2Replace, matcap2, matcap2Mask, matcapEmission, _Matcap2EmissionStrength
+ #ifdef POI_LIGHTING
+ ,_Matcap2LightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ ,_BlackLightMaskMatcap2
+ #endif
+ );
+ }
+
+ return matcapEmission;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMatcap.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMatcap.cginc.meta
new file mode 100644
index 00000000..19736053
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMatcap.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 400822fcfc2960f45a004321fa06d679
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMath.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMath.cginc
new file mode 100644
index 00000000..98af2364
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMath.cginc
@@ -0,0 +1,78 @@
+#ifndef POI_MATH
+ #define POI_MATH
+
+ #ifndef pi
+ #define pi float(3.14159265359)
+ #endif
+
+ 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)
+ {
+ return float4(
+ cos(angle / 2.0),
+ normalize(axis) * sin(angle / 2.0)
+ );
+ }
+
+ 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), degree_to_radius(rotation.x));
+ float4 qy = get_quaternion_from_angle(float3(0, 1, 0), degree_to_radius(rotation.y));
+ float4 qz = get_quaternion_from_angle(float3(0, 0, 1), degree_to_radius(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;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMath.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMath.cginc.meta
new file mode 100644
index 00000000..1c2a41b8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMath.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8076e22efb150f448b44b9c66821c39f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMetal.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMetal.cginc
new file mode 100644
index 00000000..1088cdf4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMetal.cginc
@@ -0,0 +1,126 @@
+#ifndef POI_METAL
+ #define POI_METAL
+
+ samplerCUBE _CubeMap;
+ float _SampleWorld;
+ POI_TEXTURE_NOSAMPLER(_MetallicMask);
+ POI_TEXTURE_NOSAMPLER(_SmoothnessMask);
+ float _Metallic;
+ float _InvertSmoothness;
+ float _Smoothness;
+ float _EnableMetallic;
+ float3 _MetalReflectionTint;
+ POI_TEXTURE_NOSAMPLER(_MetallicTintMap);
+
+ float3 finalreflections;
+ float metalicMap;
+ float3 reflection;
+ float roughness;
+ float lighty_boy_uwu_var;
+
+ bool shouldMetalHappenBeforeLighting()
+ {
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiCam.reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ bool probeExists = !(unity_SpecCube0_HDR.a == 0 && envSample.a == 0);
+ return probeExists && !_SampleWorld;
+ }
+
+ float3 fresnelRelflection()
+ {
+ half3 dotNV = 1 - abs(poiLight.nDotV);
+ half f = dotNV * dotNV * dotNV * dotNV;
+ //f *= i_sold.fresnel;
+ return lerp(lerp(DielectricSpec.rgb, albedo.rgb, metalicMap), saturate(1 - roughness + metalicMap), f);
+ }
+
+ void ApplyMetallics(inout float4 finalColor)
+ {
+ #ifdef FORWARD_BASE_PASS
+ metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[_MetallicMaskUV], _MetallicMaskPan) * _Metallic;
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[_SmoothnessMaskUV], _SmoothnessMaskPan));
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskMetallic != 4)
+ {
+ metalicMap *= blackLightMask[_BlackLightMaskMetallic];
+ smoothnessMap *= blackLightMask[_BlackLightMaskMetallic];
+ }
+ #endif
+
+ if(_InvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _Smoothness;
+ roughness = 1 - smoothnessMap;
+
+
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = roughness;
+ envData.reflUVW = BoxProjection(
+ poiCam.reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube0_ProbePosition,
+ unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax
+ );
+ float3 probe0 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData
+ );
+ envData.reflUVW = BoxProjection(
+ poiCam.reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax
+ );
+
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ float3 probe1 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0),
+ unity_SpecCube0_HDR, envData
+ );
+ reflection = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ reflection = probe0;
+ }
+
+ float reflecty_lighty_boy_uwu_var_2 = 1.0 / (roughness * roughness + 1.0);
+
+ half4 tintMap = POI2D_SAMPLER_PAN(_MetallicTintMap, _MainTex, poiMesh.uv[_MetallicTintMapUV], _MetallicTintMapPan);
+ finalColor.rgb *= (1 - metalicMap * tintMap.a);
+ finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection() * _MetalReflectionTint * tintMap.rgb * tintMap.a;
+ #endif
+ }
+
+ void ApplyMetallicsFake(inout float4 finalColor)
+ {
+ #ifdef FORWARD_BASE_PASS
+ metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[_MetallicMaskUV], _MetallicMaskPan) * _Metallic;
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[_SmoothnessMaskUV], _SmoothnessMaskPan));
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskMetallic != 4)
+ {
+ metalicMap *= blackLightMask[_BlackLightMaskMetallic];
+ smoothnessMap *= blackLightMask[_BlackLightMaskMetallic];
+ }
+ #endif
+
+ if(_InvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _Smoothness;
+ roughness = 1 - smoothnessMap;
+
+ reflection = texCUBElod(_CubeMap, float4(poiCam.reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+
+ float reflecty_lighty_boy_uwu_var_2 = 1.0 / (roughness * roughness + 1.0);
+ half4 tintMap = POI2D_SAMPLER_PAN(_MetallicTintMap, _MainTex, poiMesh.uv[_MetallicTintMapUV], _MetallicTintMapPan);
+ finalColor.rgb *= (1 - metalicMap * tintMap.a);
+ finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection() * _MetalReflectionTint * tintMap.rgb * tintMap.a;
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMetal.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMetal.cginc.meta
new file mode 100644
index 00000000..0106f996
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMetal.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: efbee79deb8603844a85b3268440162a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMirror.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMirror.cginc
new file mode 100644
index 00000000..4c943baa
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMirror.cginc
@@ -0,0 +1,77 @@
+#ifndef POI_MIRROR
+ #define POI_MIRROR
+
+ int _Mirror;
+ float _EnableMirrorTexture;
+ POI_TEXTURE_NOSAMPLER(_MirrorTexture);
+
+
+ void applyMirrorRenderVert(inout float4 vertex)
+ {
+ UNITY_BRANCH
+ if (_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ void applyMirrorRenderFrag()
+ {
+ UNITY_BRANCH
+ if(_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ void applyMirrorTexture()
+ {
+ UNITY_BRANCH
+ if(_EnableMirrorTexture)
+ {
+ if(IsInMirror())
+ {
+ mainTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ }
+ }
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMirror.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMirror.cginc.meta
new file mode 100644
index 00000000..22d5619b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiMirror.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b67e74201ee1abc4092033e08aa93e9e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineFrag.cginc
new file mode 100644
index 00000000..25d6a507
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineFrag.cginc
@@ -0,0 +1,76 @@
+float _OutlineRimLightBlend;
+float _OutlineLit;
+float _OutlineTintMix;
+
+float4 frag(v2f i, uint facing: SV_IsFrontFace): COLOR
+{
+ poiMesh.uv[0] = i.uv0.xy;
+ poiMesh.uv[1] = i.uv0.zw;
+ poiMesh.uv[2] = i.uv1.xy;
+ poiMesh.uv[3] = i.uv1.zw;
+
+ #ifdef POI_DATA
+ InitData(i, facing);
+ #endif
+
+ #ifdef POI_MAINTEXTURE
+ initTextureData();
+ #endif
+ #ifdef POI_DATA
+ calculateLightingData(i);
+ #endif
+ fixed4 col = mainTexture;
+ float alphaMultiplier = smoothstep(_OutlineFadeDistance.x, _OutlineFadeDistance.y, distance(getCameraPosition(), i.worldPos));
+ float OutlineMask = tex2D(_OutlineMask, TRANSFORM_TEX(i.uv0.xy, _OutlineMask) + _Time.x * _OutlineTexturePan.zw).r;
+ clip(OutlineMask * _LineWidth - 0.001);
+
+ float _alphaMask_tex_var = POI2D_SAMPLER_PAN(_AlphaMask, _MainTex, poiMesh.uv[_AlphaMaskUV], _AlphaMaskPan);
+
+ col = col * 0.00000000001 + tex2D(_OutlineTexture, TRANSFORM_TEX((i.uv0.xy + (_OutlineTexturePan.xy * _Time.g)), _OutlineTexture));
+ col.a *= albedo.a;
+ col.a *= alphaMultiplier;
+
+ #ifdef POI_RANDOM
+ col.a *= i.angleAlpha;
+ #endif
+
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ col.a *= _alphaMask_tex_var * _LineColor.a;
+ applyDithering(col);
+ clip(col.a - _Clip);
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderFrag();
+ #endif
+
+ UNITY_BRANCH
+ if (_OutlineMode == 1)
+ {
+ #ifdef POI_MIRROR
+ applyMirrorTexture();
+ #endif
+ col.rgb = mainTexture.rgb;
+ }
+ else if(_OutlineMode == 2)
+ {
+ col.rgb = lerp(col.rgb, poiLight.color, _OutlineRimLightBlend);
+ }
+ col.rgb *= _LineColor.rgb;
+
+ if(_OutlineMode == 1)
+ {
+ col.rgb = lerp(col.rgb, mainTexture.rgb, _OutlineTintMix);
+ }
+
+ float4 finalColor = col;
+
+ #ifdef POI_LIGHTING
+ UNITY_BRANCH
+ if(_OutlineLit)
+ {
+ finalColor.rgb *= calculateLighting(finalColor.rgb);
+ }
+ #endif
+ finalColor.rgb += (col.rgb * _OutlineEmission);
+ return finalColor;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineFrag.cginc.meta
new file mode 100644
index 00000000..b0ad7dd8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3b1d5b8f4ce9942459d2943f23b0ebd5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineVert.cginc
new file mode 100644
index 00000000..dc3fa7ef
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineVert.cginc
@@ -0,0 +1,90 @@
+#ifndef OutlineVert
+ #define OutlineVert
+
+ #include "CGI_PoiV2F.cginc"
+
+ uint _OutlineMode;
+ float4 _OutlinePersonaDirection;
+ float4 _OutlineDropShadowOffset;
+ float _OutlineUseVertexColors;
+ float _OutlineFixedSize;
+
+ sampler2D _OutlineMask; float4 _OutlineMask_ST;
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ UNITY_INITIALIZE_OUTPUT(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ o.uv0.xy = v.uv0.xy;
+ o.uv0.zw = v.uv1.xy;
+ o.uv1.xy = v.uv2.xy;
+ o.uv1.zw = v.uv3.xy;
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderVert(v.vertex);
+ #endif
+
+ o.uv0.xy = v.uv0 + _OutlineGlobalPan.xy * _Time.y;
+ float outlineMask = 1;
+ #ifndef SIMPLE
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(TRANSFORM_TEX(o.uv0.xy, _OutlineMask) + _Time.x * _OutlineTexturePan.zw, 0, 0)).rgb);
+ #endif
+ UNITY_BRANCH
+ if (_OutlineUseVertexColors == 0)
+ {
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ }
+ else
+ {
+ o.normal = UnityObjectToWorldNormal(v.color);
+ }
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ UNITY_BRANCH
+ if(_OutlineFixedSize)
+ {
+ distanceOffset *= distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, v.vertex).xyz);
+ }
+
+ float3 offset = o.normal * (_LineWidth / 100) * outlineMask * distanceOffset;
+
+ UNITY_BRANCH
+ if(_OutlineMode == 2)
+ {
+ float3 lightDirection = poiLight.direction = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, o.normal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if(_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, o.normal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if(_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+
+ o.worldPos = mul(unity_ObjectToWorld, v.vertex) + float4(offset, 0);
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ o.pos = UnityWorldToClipPos(o.worldPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.angleAlpha = 1;
+ #ifdef POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+ UNITY_TRANSFER_SHADOW(o, o.uv0);
+ UNITY_TRANSFER_FOG(o, o.pos);
+ return o;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineVert.cginc.meta
new file mode 100644
index 00000000..2575d8e0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiOutlineVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9a127201e1056cc47b2653676d4a14ab
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPanosphere.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPanosphere.cginc
new file mode 100644
index 00000000..b0f642a8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPanosphere.cginc
@@ -0,0 +1,70 @@
+#ifndef PANOSPHERE
+ #define PANOSPHERE
+
+ sampler2D _PanosphereTexture; float4 _PanosphereTexture_ST;
+ POI_TEXTURE_NOSAMPLER(_PanoMask);
+ float _PanoEmission;
+ float _PanoBlend;
+ float4 _PanosphereColor;
+ float3 _PanospherePan;
+ float _PanoToggle;
+ float _PanoCubeMapToggle;
+ float _PanoInfiniteStereoToggle;
+ samplerCUBE _PanoCubeMap; half4 _PanoCubeMap_HDR;
+
+ float3 panoColor;
+ float panoMask;
+
+ float2 projectIt(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude + _Time.y * _PanospherePan.x, latitude + _Time.y * _PanospherePan.y) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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;
+ }
+
+ void calculatePanosphere()
+ {
+ panoMask = POI2D_SAMPLER_PAN(_PanoMask, _MainTex, poiMesh.uv[_PanoMaskUV], _PanoMaskPan);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskPanosphere != 4)
+ {
+ panoMask *= blackLightMask[_BlackLightMaskPanosphere];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if(_PanoCubeMapToggle)
+ {
+ float3 cubeUV = mul(poiRotationMatrixFromAngles(_PanospherePan.xyz * _Time.y), float4(-poiCam.viewDir, 1));
+ half4 cubemap = texCUBE(_PanoCubeMap, cubeUV);
+ panoColor = DecodeHDR(cubemap, _PanoCubeMap_HDR);
+ }
+ else
+ {
+ float2 uv = projectIt(normalize(lerp(getCameraPosition().xyz, poiCam.worldPos.xyz, _PanoInfiniteStereoToggle) - poiMesh.worldPos.xyz) * - 1);
+
+ float2 ddxuv = ddx(uv);
+ float2 ddyuv = ddy(uv);
+ if(any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ panoColor = tex2D(_PanosphereTexture, TRANSFORM_TEX(uv, _PanosphereTexture), ddxuv, ddyuv).rgb * _PanosphereColor.rgb;
+ }
+ }
+
+ void applyPanosphereColor(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor.rgb, panoColor, _PanoBlend * panoMask);
+ }
+
+ void applyPanosphereEmission(inout float3 finalEmission)
+ {
+ finalEmission += panoColor * _PanoBlend * panoMask * _PanoEmission;
+ }
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPanosphere.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPanosphere.cginc.meta
new file mode 100644
index 00000000..0d569953
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPanosphere.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 77d5438d9a3794244bd96fe1126e5a2b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiParallax.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiParallax.cginc
new file mode 100644
index 00000000..9f7b27d6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiParallax.cginc
@@ -0,0 +1,142 @@
+#ifndef POI_PARALLAX
+ #define POI_PARALLAX
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ParallaxHeightMap); float4 _ParallaxHeightMap_ST;
+ POI_TEXTURE_NOSAMPLER(_ParallaxHeightMapMask);
+ float2 _ParallaxHeightMapPan;
+ float _ParallaxStrength;
+ float _ParallaxHeightMapEnabled;
+ uint _ParallaxUV;
+
+ //Internal
+ float _ParallaxInternalMapEnabled;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ParallaxInternalMap); float4 _ParallaxInternalMap_ST;
+ POI_TEXTURE_NOSAMPLER(_ParallaxInternalMapMask);
+ float _ParallaxInternalIterations;
+ float _ParallaxInternalMinDepth;
+ float _ParallaxInternalMaxDepth;
+ float _ParallaxInternalMinFade;
+ float _ParallaxInternalMaxFade;
+ float4 _ParallaxInternalMinColor;
+ float4 _ParallaxInternalMaxColor;
+ float4 _ParallaxInternalPanSpeed;
+ float4 _ParallaxInternalPanDepthSpeed;
+ float _ParallaxInternalHeightmapMode;
+ float _ParallaxInternalHeightFromAlpha;
+
+ float GetParallaxHeight(float2 uv)
+ {
+ return clamp(UNITY_SAMPLE_TEX2D_SAMPLER(_ParallaxHeightMap, _MainTex, TRANSFORM_TEX(uv, _ParallaxHeightMap) + _Time.x * _ParallaxHeightMapPan).g, 0, .99999);
+ }
+ /*
+ float2 ParallaxOffset(float2 viewDir)
+ {
+ float height = GetParallaxHeight();
+ height -= 0.5;
+ height *= _ParallaxStrength;
+ return viewDir * height;
+ }
+ */
+ float2 ParallaxRaymarching(float2 viewDir)
+ {
+ float2 uvOffset = 0;
+ float stepSize = 0.1;
+ float2 uvDelta = viewDir * (stepSize * _ParallaxStrength);
+
+ float stepHeight = 1;
+ float surfaceHeight = GetParallaxHeight(poiMesh.uv[_ParallaxUV]);
+
+
+ float2 prevUVOffset = uvOffset;
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ for (int i = 1; i < 10 && stepHeight > surfaceHeight; i ++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ surfaceHeight = GetParallaxHeight(poiMesh.uv[_ParallaxUV] + uvOffset);
+ }
+
+ float prevDifference = prevStepHeight - prevSurfaceHeight;
+ float difference = surfaceHeight - stepHeight;
+ float t = prevDifference / (prevDifference + difference);
+ uvOffset = prevUVOffset -uvDelta * t;
+
+ return uvOffset *= POI2D_SAMPLER_PAN(_ParallaxHeightMapMask, _MainTex, poiMesh.uv[_ParallaxHeightMapMaskUV], _ParallaxHeightMapMaskPan).r;
+ }
+
+ void calculateandApplyParallax()
+ {
+ UNITY_BRANCH
+ if (_ParallaxHeightMapEnabled)
+ {
+ float2 parallaxOffset = ParallaxRaymarching(poiCam.tangentViewDir.xy);
+ UNITY_BRANCH
+ if(_ParallaxUV == 0)
+ {
+ poiMesh.uv[0] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 1)
+ {
+ poiMesh.uv[1] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 2)
+ {
+ poiMesh.uv[2] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 3)
+ {
+ poiMesh.uv[3] += parallaxOffset;
+ }
+ }
+ }
+
+ void calculateAndApplyInternalParallax(inout float4 finalColor)
+ {
+ #if defined(_PARALLAXMAP)
+ UNITY_BRANCH
+ if(_ParallaxInternalMapEnabled)
+ {
+ float3 parallax = 0;
+ for (int j = _ParallaxInternalIterations; j > 0; j --)
+ {
+ float ratio = (float)j / _ParallaxInternalIterations;
+ float2 parallaxOffset = _Time.y * (_ParallaxInternalPanSpeed + (1 - ratio) * _ParallaxInternalPanDepthSpeed);
+ float fade = lerp(_ParallaxInternalMinFade, _ParallaxInternalMaxFade, ratio);
+ float4 parallaxColor = UNITY_SAMPLE_TEX2D_SAMPLER(_ParallaxInternalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _ParallaxInternalMap) + lerp(_ParallaxInternalMinDepth, _ParallaxInternalMaxDepth, ratio) * - poiCam.tangentViewDir.xy + parallaxOffset);
+ float3 parallaxTint = lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, ratio);
+ float parallaxHeight;
+ if(_ParallaxInternalHeightFromAlpha)
+ {
+ parallaxTint *= parallaxColor.rgb;
+ parallaxHeight = parallaxColor.a;
+ }
+ else
+ {
+ parallaxHeight = parallaxColor.r;
+ }
+ //float parallaxColor *= lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, 1 - ratio);
+ UNITY_BRANCH
+ if (_ParallaxInternalHeightmapMode == 1)
+ {
+ parallax = lerp(parallax, parallaxTint * fade, parallaxHeight >= 1 - ratio);
+ }
+ else
+ {
+ parallax += parallaxTint * parallaxHeight * fade;
+ }
+ }
+ //parallax /= _ParallaxInternalIterations;
+ finalColor.rgb += parallax * POI2D_SAMPLER_PAN(_ParallaxInternalMapMask, _MainTex, poiMesh.uv[_ParallaxInternalMapMaskUV], _ParallaxInternalMapMaskPan).r;
+ }
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiParallax.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiParallax.cginc.meta
new file mode 100644
index 00000000..e8b7edba
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiParallax.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 97bde44d013cc0e49869a7e8917bcf86
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPass.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPass.cginc
new file mode 100644
index 00000000..91c11e47
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPass.cginc
@@ -0,0 +1,263 @@
+/*
+USED---------------------------------------------
+"_PARALLAXMAP",
+"_REQUIRE_UV2",
+"_SUNDISK_NONE",
+"_DETAIL_MULX2",
+"LOD_FADE_CROSSFADE",
+"_GLOSSYREFLECTIONS_OFF",
+"_METALLICGLOSSMAP",
+"_COLORADDSUBDIFF_ON",
+"_SPECGLOSSMAP",
+"_TERRAIN_NORMAL_MAP",
+"_SUNDISK_SIMPLE",
+"_EMISSION",
+"_COLORCOLOR_ON",
+"_COLOROVERLAY_ON",
+"_ALPHAMODULATE_ON",
+"_SUNDISK_HIGH_QUALITY",
+"_MAPPING_6_FRAMES_LAYOUT",
+"_NORMALMAP"
+"EFFECT_BUMP",
+"BLOOM",
+"BLOOM_LOW",
+"GRAIN",
+"DEPTH_OF_FIELD",
+"USER_LUT",
+"CHROMATIC_ABERRATION_LOW",
+"FXAA",
+"BLOOM_LENS_DIRT",
+"_FADING_ON",
+"CHROMATIC_ABERRATION",
+"DISTORT",
+"GEOM_TYPE_BRANCH",
+"_SPECULARHIGHLIGHTS_OFF",
+
+UNUSED-------------------------------------------
+"_ALPHAPREMULTIPLY_ON",
+"_ALPHATEST_ON",
+"_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A",
+"BILLBOARD_FACE_CAMERA_POS",
+"EFFECT_HUE_VARIATION",
+"ETC1_EXTERNAL_ALPHA",
+"GEOM_TYPE_FROND",
+"GEOM_TYPE_LEAF",
+"GEOM_TYPE_MESH",
+"LOD_FADE_CROSSFADE",
+"PIXELSNAP_ON",
+"STEREO_INSTANCING_ON",
+"STEREO_MULTIVIEW_ON",
+"UNITY_HDR_ON",
+"UNITY_SINGLE_PASS_STEREO",
+"UNITY_UI_ALPHACLIP",
+"UNITY_UI_CLIP_RECT",
+// Post Processing Stack V1 and V2
+// This is mostly just safe keeping somewhere
+"FOG_OFF",
+"FOG_LINEAR",
+"FOG_EXP",
+"FOG_EXP2",
+"ANTI_FLICKER",
+"UNITY_COLORSPACE_GAMMA",
+"SOURCE_GBUFFER",
+"AUTO_KEY_VALUE",
+"DITHERING",
+"TONEMAPPING_NEUTRAL",
+"TONEMAPPING_FILMIC",
+"DEPTH_OF_FIELD_COC_VIEW",
+"COLOR_GRADING",
+"COLOR_GRADING_LOG_VIEW",
+"VIGNETTE_CLASSIC",
+"VIGNETTE_MASKED",
+"",
+"FXAA_LOW",
+"FXAA_KEEP_ALPHA",
+"STEREO_INSTANCING_ENABLED",
+"STEREO_DOUBLEWIDE_TARGET",
+"TONEMAPPING_ACES",
+"TONEMAPPING_CUSTOM",
+"APPLY_FORWARD_FOG",
+"VIGNETTE",
+"FINALPASS",
+"COLOR_GRADING_HDR_3D",
+"COLOR_GRADING_HDR",
+"AUTO_EXPOSURE"
+
+DO NOT USE-------------------------------
+DISTORT,
+TODO: _ALPHAMODULATE_ON
+*/
+
+
+#ifndef POI_PASS
+ #define POI_PASS
+
+ #include "UnityCG.cginc"
+ #include "Lighting.cginc"
+ #include "UnityPBSLighting.cginc"
+ #include "AutoLight.cginc"
+
+ #ifdef POI_META_PASS
+ #include "UnityMetaPass.cginc"
+ #endif
+
+ #include "CGI_PoiMacros.cginc"
+ #include "CGI_PoiDefines.cginc"
+
+ #include "CGI_Poicludes.cginc"
+ #include "CGI_PoiHelpers.cginc"
+
+ #ifdef _SUNDISK_NONE
+ #include "CGI_PoiRandom.cginc"
+ #endif
+
+ #ifdef _REQUIRE_UV2
+ #include "CGI_PoiMirror.cginc"
+ #endif
+ #include "CGI_PoiVertexManipulations.cginc"
+
+ #include "CGI_PoiSpawnInVert.cginc"
+
+ #include "CGI_PoiV2F.cginc"
+
+ #ifdef BLOOM_LOW
+ #include "CGI_PoiBulge.cginc"
+ #endif
+
+ #include "CGI_PoiVert.cginc"
+
+ #ifdef TESSELATION
+ #include "CGI_PoiTessellation.cginc"
+ #endif
+
+ #ifdef CUTOUT
+ #include "CGI_PoiDithering.cginc"
+ #endif
+
+ #ifdef _PARALLAXMAP
+ #include "CGI_PoiParallax.cginc"
+ #endif
+
+ #ifdef USER_LUT
+ #include "CGI_PoiUVDistortion.cginc"
+ #endif
+
+ #include "CGI_PoiData.cginc"
+
+ #ifdef _SPECULARHIGHLIGHTS_OFF
+ #include "CGI_PoiBlackLight.cginc"
+ #endif
+
+ #include "CGI_PoiSpawnInFrag.cginc"
+
+ #ifdef WIREFRAME
+ #include "CGI_PoiWireframe.cginc"
+ #endif
+
+ #ifdef DISTORT
+ #include "CGI_PoiDissolve.cginc"
+ #endif
+
+ #ifdef DEPTH_OF_FIELD
+ #include "CGI_PoiHologram.cginc"
+ #endif
+
+ #ifdef FXAA
+ #include "CGI_PoiRGBMask.cginc"
+ #endif
+
+ #ifdef BLOOM_LENS_DIRT
+ #include "CGI_PoiIridescence.cginc"
+ #endif
+
+
+ #ifdef FUR
+ #include "CGI_PoiFur.cginc"
+ #include "CGI_PoiGeomFur.cginc"
+ #endif
+
+ #include "CGI_PoiMainTex.cginc"
+
+ #ifdef GEOM_TYPE_BRANCH
+ #include "CGI_PoiDecal.cginc"
+ #endif
+
+ #ifdef CHROMATIC_ABERRATION
+ #include "CGI_PoiVoronoi.cginc"
+ #endif
+
+ #ifdef _DETAIL_MULX2
+ #include "CGI_PoiPanosphere.cginc"
+ #endif
+
+ #ifdef EFFECT_BUMP
+ #include "CGI_PoiMSDF.cginc"
+ #endif
+
+ #ifdef GRAIN
+ #include "CGI_PoiDepthColor.cginc"
+ #endif
+
+ #ifdef LOD_FADE_CROSSFADE
+ #include "CGI_PoiLighting.cginc"
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ #include "CGI_PoiFlipbook.cginc"
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #include "CGI_PoiRimlighting.cginc"
+ #endif
+
+ #ifdef _MAPPING_6_FRAMES_LAYOUT
+ #include "CGI_PoiEnvironmentalRimLighting.cginc"
+ #endif
+
+ #ifdef _METALLICGLOSSMAP
+ #include "CGI_PoiMetal.cginc"
+ #endif
+
+ #ifdef _COLORADDSUBDIFF_ON
+ #include "CGI_PoiMatcap.cginc"
+ #endif
+
+ #ifdef _SPECGLOSSMAP
+ #include "CGI_PoiSpecular.cginc"
+ #endif
+
+ #ifdef BLOOM
+ #include "CGI_PoiVideo.cginc"
+ #endif
+
+ #ifdef _TERRAIN_NORMAL_MAP
+ #include "CGI_PoiSubsurfaceScattering.cginc"
+ #endif
+
+ #ifdef POI_GRABS_ASS
+ #include "CGI_PoiBlending.cginc"
+ #include "CGI_PoiGrab.cginc"
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ #include "CGI_PoiGlitter.cginc"
+ #endif
+
+ #ifdef _EMISSION
+ #include "CGI_PoiEmission.cginc"
+ #endif
+
+ #ifdef _COLORCOLOR_ON
+ #include "CGI_PoiClearCoat.cginc"
+ #endif
+
+ #ifdef CUTOUT
+ #include "CGI_PoiAlphaToCoverage.cginc"
+ #endif
+
+ #ifdef _COLOROVERLAY_ON
+ #include "CGI_PoiDebug.cginc"
+ #endif
+ #include "CGI_PoiFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPass.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPass.cginc.meta
new file mode 100644
index 00000000..cfac868b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPass.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e1c44eaed2ce4174981f26daf9468e39
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassOutline.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassOutline.cginc
new file mode 100644
index 00000000..75b68112
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassOutline.cginc
@@ -0,0 +1,26 @@
+#ifndef POI_PASS_OUTLINE
+ #define POI_PASS_OUTLINE
+
+ #include "UnityCG.cginc"
+ #include "Lighting.cginc"
+ #include "UnityPBSLighting.cginc"
+ #include "AutoLight.cginc"
+ #include "CGI_PoiMacros.cginc"
+ #include "CGI_Poicludes.cginc"
+ #include "CGI_PoiHelpers.cginc"
+ #include "CGI_PoiOutlineVert.cginc"
+ #ifdef TESSELATION
+ #include "CGI_PoiTessellation.cginc"
+ #endif
+ #ifdef _REQUIRE_UV2
+ #include "CGI_PoiMirror.cginc"
+ #endif
+ #ifdef DISTORT
+ #include "CGI_PoiDissolve.cginc"
+ #endif
+ #include "CGI_PoiMainTex.cginc"
+ #include "CGI_PoiData.cginc"
+ #include "CGI_PoiDithering.cginc"
+ #include "CGI_PoiLighting.cginc"
+ #include "CGI_PoiOutlineFrag.cginc"
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassOutline.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassOutline.cginc.meta
new file mode 100644
index 00000000..bf2f82b4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassOutline.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ee861e2bca0ed96468676b24154fedcf
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassShadow.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassShadow.cginc
new file mode 100644
index 00000000..737a2272
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassShadow.cginc
@@ -0,0 +1,31 @@
+#ifndef POI_PASS_SHADOW
+ #define POI_PASS_SHADOW
+
+ #pragma multi_compile_shadowcaster
+ #include "UnityCG.cginc"
+ #include "UnityShaderVariables.cginc"
+
+ #include "CGI_PoiMacros.cginc"
+ #include "CGI_PoiShadowIncludes.cginc"
+ #include "CGI_PoiHelpers.cginc"
+ #include "CGI_PoiMirror.cginc"
+ #include "CGI_PoiSpawnInFrag.cginc"
+ #ifdef WIREFRAME
+ #include "CGI_PoiWireframe.cginc"
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ #include "CGI_PoiFlipbook.cginc"
+ #endif
+
+ #ifdef _SUNDISK_NONE
+ #include "CGI_PoiRandom.cginc"
+ #endif
+ #include "CGI_PoiDithering.cginc"
+ #include "CGI_PoiDissolve.cginc"
+ #include "CGI_PoiVertexManipulations.cginc"
+ #include "CGI_PoiSpawnInVert.cginc"
+ #include "CGI_PoiShadowVert.cginc"
+ #include "CGI_PoiShadowFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassShadow.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassShadow.cginc.meta
new file mode 100644
index 00000000..700e7124
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiPassShadow.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9157516b20ddd5b4a822b186d52bf029
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRGBMask.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRGBMask.cginc
new file mode 100644
index 00000000..352954d1
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRGBMask.cginc
@@ -0,0 +1,51 @@
+#ifndef POI_RGBMASK
+ #define POI_RGBMASK
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RGBMask); float4 _RGBMask_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RedTexure); float4 _RedTexure_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_GreenTexture); float4 _GreenTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_BlueTexture); float4 _BlueTexture_ST;
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+
+ float4 _RGBMaskPanning;
+ float4 _RGBRedPanning;
+ float4 _RGBGreenPanning;
+ float4 _RGBBluePanning;
+
+ float _RGBBlendMultiplicative;
+
+ uint _RGBMaskUV;
+ uint _RGBRed_UV;
+ uint _RGBGreen_UV;
+ uint _RGBBlue_UV;
+
+ float3 calculateRGBMask(float3 baseColor)
+ {
+ float3 rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiMesh.uv[_RGBMaskUV], _RGBMaskPanning).rgb;
+ float4 red = POI2D_SAMPLER_PAN(_RedTexure, _MainTex, poiMesh.uv[_RGBRed_UV], _RGBRedPanning);
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiMesh.uv[_RGBGreen_UV], _RGBGreenPanning);
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiMesh.uv[_RGBBlue_UV], _RGBBluePanning);
+
+ UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * _RedColor.rgb, rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * _GreenColor.rgb, rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * _BlueColor.rgb, rgbMask.b * blue.a * _BlueColor.a);
+ baseColor *= RGBColor;
+ }
+ else
+ {
+ baseColor = lerp(baseColor, red.rgb * _RedColor.rgb, rgbMask.r * red.a * _RedColor.a);
+ baseColor = lerp(baseColor, green.rgb * _GreenColor.rgb, rgbMask.g * green.a * _GreenColor.a);
+ baseColor = lerp(baseColor, blue.rgb * _BlueColor.rgb, rgbMask.b * blue.a * _BlueColor.a);
+ }
+
+ return baseColor;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRGBMask.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRGBMask.cginc.meta
new file mode 100644
index 00000000..e1ff7392
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRGBMask.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e7016982238688340bba36c0b73d76e5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRNG.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRNG.cginc
new file mode 100644
index 00000000..3d1ace67
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRNG.cginc
@@ -0,0 +1,4 @@
+#ifndef POI_RNG
+ #define POI_RNG
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRNG.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRNG.cginc.meta
new file mode 100644
index 00000000..2eb457c9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRNG.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 07d86b07e2f0d7543b52ce43820c6a89
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRandom.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRandom.cginc
new file mode 100644
index 00000000..6473b764
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRandom.cginc
@@ -0,0 +1,39 @@
+#ifndef POI_RANDOM
+ #define POI_RANDOM
+
+ float _EnableRandom;
+ float m_start_Angle;
+ uint _AngleType;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin, _CameraAngleMax;
+ float _ModelAngleMin, _ModelAngleMax;
+ float _AngleMinAlpha;
+ uint _AngleCompareTo;
+
+ float ApplyAngleBasedRendering(float3 modelPos, float3 worldPos)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? modelPos : worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection)));
+ half cameraLookAtModel = remapClamped(.5 * dot(cameraToModelDirection, getCameraForward()) + .5, cameraAngleMax, cameraAngleMin, 0, 1);
+ half modelLookAtCamera = remapClamped(.5 * dot(-cameraToModelDirection, modelForwardDirection) + .5, modelAngleMax, modelAngleMin, 0, 1);
+ if (_AngleType == 0)
+ {
+ return max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if(_AngleType == 1)
+ {
+ return max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if(_AngleType == 2)
+ {
+ return max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ return 1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRandom.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRandom.cginc.meta
new file mode 100644
index 00000000..83ac20f9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRandom.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8a886c36a202bf7419200b67fa5f5d88
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRimLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRimLighting.cginc
new file mode 100644
index 00000000..31692dec
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRimLighting.cginc
@@ -0,0 +1,53 @@
+#ifndef POI_RIM
+ #define POI_RIM
+
+ float4 _RimLightColor;
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimLightColorBias;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimBrighten;
+ uint _RimLightNormal;
+
+ POI_TEXTURE_NOSAMPLER(_RimTex);
+ POI_TEXTURE_NOSAMPLER(_RimMask);
+ POI_TEXTURE_NOSAMPLER(_RimWidthNoiseTexture);
+
+ float _RimWidthNoiseStrength;
+
+ float4 rimColor = float4(0, 0, 0, 0);
+ float rim = 0;
+
+ void calculateRimLighting()
+ {
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexturePan);
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, poiMesh.normals[_RimLightNormal]));
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - abs(dot(poiCam.viewDir, poiMesh.normals[_RimLightNormal]));
+ }
+ _RimWidth -= rimNoise;
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiMesh.uv[_RimMaskUV], _RimMaskPan);
+ rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiMesh.uv[_RimTexUV], _RimTexPan) * _RimLightColor;
+ _RimWidth = lerp(_RimWidth, _RimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix);
+ rim = 1 - smoothstep(min(_RimSharpness, _RimWidth), _RimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+ }
+
+ void applyRimColor(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor.rgb, lerp(finalColor.rgb, rimColor, _RimLightColorBias) + lerp(finalColor.rgb, rimColor, _RimLightColorBias) * _RimBrighten, rim);
+ }
+ void ApplyRimEmission(inout float3 finalEmission)
+ {
+ finalEmission += rim * lerp(finalColor.rgb, rimColor, _RimLightColorBias) * _RimStrength;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRimLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRimLighting.cginc.meta
new file mode 100644
index 00000000..3527b496
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiRimLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 485481cb26387c4418383cfd1355770c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowFrag.cginc
new file mode 100644
index 00000000..c4fcb1ed
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowFrag.cginc
@@ -0,0 +1,95 @@
+#ifndef SHADOW_FRAG
+ #define SHADOW_FRAG
+
+ float2 _MainDistanceFade;
+ float _ForceOpaque;
+ float _MainShadowClipMod;
+ float2 _AlphaMaskPan;
+ uint _AlphaMaskUV;
+ float _AlphaMod;
+
+ #ifdef TRANSPARENT
+ sampler3D _DitherMaskLOD;
+ #endif
+
+ half4 fragShadowCaster(
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ V2FShadow i
+ #endif
+ ): SV_Target
+ {
+ _Clip = clamp(_Clip + _MainShadowClipMod, - .001, 1.001);
+ float2 uv[4] = {
+ i.uv, i.uv1, i.uv2, i.uv3,
+ };
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderFrag();
+ #endif
+
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+
+ half alpha = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex)).a;
+
+
+
+ UNITY_BRANCH
+ if (_EnableMirrorTexture)
+ {
+ if(IsInMirror())
+ {
+ alpha = UNITY_SAMPLE_TEX2D_SAMPLER(_MirrorTexture, _MainTex, TRANSFORM_TEX(i.uv, _MirrorTexture)).a;
+ }
+ }
+
+
+ alpha *= smoothstep(_MainDistanceFade.x, _MainDistanceFade.y, distance(i.modelPos, _WorldSpaceCameraPos));
+ half alphaMask = POI2D_PAN(_AlphaMask, uv[_AlphaMaskUV], _AlphaMaskPan);
+ alpha *= alphaMask;
+ alpha *= _Color.a;
+ alpha += _AlphaMod;
+ alpha = saturate(alpha);
+
+ #ifdef OPAQUE
+ alpha = 1;
+ #endif
+
+ clip(alpha - 0.01);
+
+ #if defined(CUTOUT)
+ applyShadowDithering(alpha, calcScreenUVs(i.grabPos).xy);
+ #endif
+
+ #ifdef POI_DISSOLVE
+ alpha *= calculateShadowDissolveAlpha(i.worldPos, i.localPos, i.uv);
+ #endif
+
+ #ifdef POI_RANDOM
+ alpha *= i.angleAlpha;
+ #endif
+
+ #if defined(CUTOUT) || defined(TRANSPARENT)
+ #ifndef SIMPLE
+ applySpawnInShadow(uv[0], i.localPos);
+ #endif
+ #if defined(POI_FLIPBOOK)
+ alpha *= applyFlipbookAlphaToShadow(uv[_FlipbookTexArrayUV]);
+ #endif
+ #endif
+
+ #if defined(CUTOUT)
+ #ifndef SIMPLE
+ clip(alpha - _Clip);
+ #endif
+ #endif
+
+ #if defined(TRANSPARENT)
+ float dither = tex3D(_DitherMaskLOD, float3(i.pos.xy * .25, alpha * 0.9375)).a;
+ clip(dither - 0.01);
+ #endif
+
+ #endif
+ SHADOW_CASTER_FRAGMENT(i)
+ }
+
+ #endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowFrag.cginc.meta
new file mode 100644
index 00000000..cac5b9ae
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 765e39634f873914e92a4b4fd2245918
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowIncludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowIncludes.cginc
new file mode 100644
index 00000000..6d9df4a0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowIncludes.cginc
@@ -0,0 +1,41 @@
+#ifndef SHADOW_INCLUDES
+ #define SHADOW_INCLUDES
+
+ #define UNITY_STANDARD_USE_SHADOW_UVS 1
+
+ float4 _Color;
+ float _Clip;
+ UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST;
+ sampler2D _AlphaMask; float4 _AlphaMask_ST;
+
+ struct VertexInputShadow
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ struct V2FShadow
+ {
+ V2F_SHADOW_CASTER_NOPOS
+ float4 pos: SV_POSITION;
+ float2 uv: TEXCOORD1;
+ float2 uv1: TEXCOORD2;
+ float2 uv2: TEXCOORD3;
+ float2 uv3: TEXCOORD4;
+ float3 modelPos: TEXCOORD5;
+ float4 worldPos: TEXCOORD6;
+ float4 localPos: TEXCOORD7;
+ float3 angleAlpha: TEXCOORD8;
+ float4 grabPos: TEXCOORD9;
+ fixed3 barycentricCoordinates: TEXCOORD10;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowIncludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowIncludes.cginc.meta
new file mode 100644
index 00000000..13c72e8d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowIncludes.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8de0b71a379d0404dbb836ac220d2b2b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowVert.cginc
new file mode 100644
index 00000000..0b022c71
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowVert.cginc
@@ -0,0 +1,73 @@
+float _EnableTouchGlow, _EnableBulge;
+uint _VertexManipulationHeightUV;
+
+V2FShadow vertShadowCaster(VertexInputShadow v)
+{
+ V2FShadow o;
+ UNITY_SETUP_INSTANCE_ID(v);
+
+ applyLocalVertexTransformation(v.normal, v.vertex);
+
+ UNITY_INITIALIZE_OUTPUT(V2FShadow, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ o.localPos = v.vertex;
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ o.uv = v.uv0;
+ o.uv1 = v.uv1;
+ o.uv2 = v.uv2;
+ o.uv3 = v.uv3;
+
+
+ float2 uvToUse = 0;
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 0)
+ {
+ uvToUse = v.uv0.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 1)
+ {
+ uvToUse = v.uv1.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 2)
+ {
+ uvToUse = v.uv2.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 3)
+ {
+ uvToUse = v.uv3.xy;
+ }
+
+ applyWorldVertexTransformation(o.worldPos, o.localPos, v.normal, uvToUse);
+ applyVertexGlitching(o.worldPos, o.localPos);
+ applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy);
+ applyVertexRounding(o.worldPos, o.localPos);
+ o.pos = UnityObjectToClipPos(o.localPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+
+ UNITY_BRANCH
+ if(_EnableTouchGlow || _EnableBulge)
+ {
+ o.pos = UnityObjectToClipPos(float3(0, 0, -5));
+ o.localPos.xyz = float3(0, 0, -5);
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ }
+
+ o.angleAlpha = 1;
+ #ifdef POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+
+ o.pos = UnityClipSpaceShadowCasterPos(o.localPos, v.normal);
+ o.pos = UnityApplyLinearShadowBias(o.pos);
+
+ return o;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowVert.cginc.meta
new file mode 100644
index 00000000..e9d33572
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiShadowVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 35014a9d0cbbe334baa88f256affa90d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInFrag.cginc
new file mode 100644
index 00000000..1847bce5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInFrag.cginc
@@ -0,0 +1,54 @@
+#ifndef POI_SPAWN_IN_FRAG
+ #define POI_SPAWN_FRAG
+
+ #ifndef SPAWN_IN_VARIABLES
+ #define SPAWN_IN_VARIABLES
+
+ float3 _SpawnInGradientStart;
+ float3 _SpawnInGradientFinish;
+ fixed _SpawnInAlpha;
+ fixed _SpawnInNoiseIntensity;
+ float3 _SpawnInEmissionColor;
+ float _SpawnInEmissionOffset;
+ float _SpawnInVertOffset;
+ float _SpawnInVertOffsetOffset;
+ float _EnableScifiSpawnIn;
+ #endif
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_SpawnInNoise); float4 _SpawnInNoise_ST;
+
+ float calculateGradientValueFrag(float3 start, float3 finish, float3 localPos)
+ {
+ return inverseLerp3(start, finish, localPos);
+ }
+
+ void applySpawnIn(inout float4 finalColor, inout float3 spawnInEmission, float2 uv, float3 localPos)
+ {
+ UNITY_BRANCH
+ if (_EnableScifiSpawnIn)
+ {
+ float noise = UNITY_SAMPLE_TEX2D_SAMPLER(_SpawnInNoise, _MainTex, TRANSFORM_TEX(uv, _SpawnInNoise)).r * _SpawnInAlpha * _SpawnInNoiseIntensity;
+ float gradient = calculateGradientValueFrag(_SpawnInGradientStart, _SpawnInGradientFinish, localPos);
+ float inverseGradient = 1 - gradient;
+ float alpha = gradient - _SpawnInAlpha - noise;
+ spawnInEmission = saturate(inverseGradient + _SpawnInAlpha + _SpawnInEmissionOffset +noise - 1) * _SpawnInEmissionColor;
+ #if defined(TRANSPARENT) || defined(CUTOUT)
+ clip(ceil(alpha) - 0.001);
+ #endif
+ }
+ }
+
+ void applySpawnInShadow(float2 uv, float3 localPos)
+ {
+ UNITY_BRANCH
+ if(_EnableScifiSpawnIn)
+ {
+ float noise = UNITY_SAMPLE_TEX2D_SAMPLER(_SpawnInNoise, _MainTex, TRANSFORM_TEX(uv, _SpawnInNoise)).r * _SpawnInAlpha * _SpawnInNoiseIntensity;
+ float gradient = calculateGradientValueFrag(_SpawnInGradientStart, _SpawnInGradientFinish, localPos);
+ float alpha = gradient - _SpawnInAlpha - noise + length(_SpawnInVertOffset);
+ #if defined(TRANSPARENT) || defined(CUTOUT)
+ clip(ceil(alpha) - 0.001);
+ #endif
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInFrag.cginc.meta
new file mode 100644
index 00000000..7b320fbe
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4c5a4e92900ae7042b1a0d9d35c01fb5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInVert.cginc
new file mode 100644
index 00000000..15044889
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInVert.cginc
@@ -0,0 +1,40 @@
+#ifndef POI_SPAWN_IN_FRAG
+ #define POI_SPAWN_FRAG
+
+ #ifndef SPAWN_IN_VARIABLES
+ #define SPAWN_IN_VARIABLES
+
+ float3 _SpawnInGradientStart;
+ float3 _SpawnInGradientFinish;
+ fixed _SpawnInAlpha;
+ fixed _SpawnInNoiseIntensity;
+ float3 _SpawnInEmissionColor;
+ float _SpawnInEmissionOffset;
+ float _SpawnInVertOffset;
+ float _SpawnInVertOffsetOffset;
+ float _EnableScifiSpawnIn;
+
+ #endif
+ //sampler2D _SpawnInNoiseVert; float4 _SpawnInNoiseVert_ST;
+
+ float calculateGradientValueVert(float3 start, float3 finish, float3 localPos)
+ {
+ return inverseLerp3(start, finish, localPos);
+ }
+
+ void applySpawnInVert(inout float4 worldPos, inout float4 localPos, float2 uv)
+ {
+ UNITY_BRANCH
+ if (_EnableScifiSpawnIn)
+ {
+ float noise = 0;
+ float gradient = calculateGradientValueVert(_SpawnInGradientStart, _SpawnInGradientFinish, localPos);
+ float inverseGradient = 1 - gradient;
+ float alpha = gradient - _SpawnInAlpha - noise;
+ worldPos.xyz += saturate(inverseGradient + _SpawnInAlpha + _SpawnInVertOffsetOffset -1) * float3(0, _SpawnInVertOffset, 0);
+ localPos.xyz = mul(unity_WorldToObject, worldPos);
+ }
+ //float noise = tex2Dlod(_SpawnInNoise, float4(TRANSFORM_TEX(uv, _SpawnInNoise))).r * _SpawnInAlpha * _SpawnInNoiseIntensity;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInVert.cginc.meta
new file mode 100644
index 00000000..10431999
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpawnInVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f18abe0c9ba0dfc448a7bc85c5ad58d6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpecular.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpecular.cginc
new file mode 100644
index 00000000..77261c33
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpecular.cginc
@@ -0,0 +1,478 @@
+#ifndef POI_SPECULAR
+ #define POI_SPECULAR
+ int _SpecWhatTangent;
+ int _SpecularType;
+ int _SmoothnessFrom;
+ POI_TEXTURE_NOSAMPLER(_SpecularMap);
+ fixed _CenterOutSpecColor;
+ POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMicro);
+ float _SpecularAnisoJitterMirrored;
+ POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMacro);
+ POI_TEXTURE_NOSAMPLER(_SpecularAnisoFakeUV);
+ POI_TEXTURE_NOSAMPLER(_AnisoTangentMap);
+ POI_TEXTURE_NOSAMPLER(_SpecularMask);
+ float _SpecularAnisoJitterMicroMultiplier;
+ float _SpecularAnisoJitterMacroMultiplier;
+ float4 _SpecularTint;
+ float _SpecularSmoothness;
+ float _Spec1Offset;
+ float _Spec1JitterStrength;
+ float _Spec2Smoothness;
+ float _Spec2Offset;
+ float _Spec2JitterStrength;
+ float _AnisoUseTangentMap;
+ float _AnisoSpec1Alpha;
+ float _AnisoSpec2Alpha;
+ float _SpecularInvertSmoothness;
+ half _SpecularMetallic;
+ uint _SpecularNormal;
+ uint _SpecularNormal1;
+ float _SpecularAttenuation;
+ float _SpecularAttenuation1;
+ // Toon
+ fixed _SpecularToonStart, _SpecularToonEnd;
+ half4 _SpecularToonInnerOuter;
+
+ float _EnableSpecular1;
+ int _SpecWhatTangent1;
+ int _SpecularType1;
+ int _SmoothnessFrom1;
+ POI_TEXTURE_NOSAMPLER(_SpecularMap1);
+ POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMicro1);
+ POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMacro1);
+ float _SpecularAnisoJitterMirrored1;
+ POI_TEXTURE_NOSAMPLER(_AnisoTangentMap1);
+ POI_TEXTURE_NOSAMPLER(_SpecularMask1);
+ float _SpecularAnisoJitterMicroMultiplier1;
+ float _SpecularAnisoJitterMacroMultiplier1;
+ float4 _SpecularTint1;
+ float _SpecularSmoothness1;
+ float _Spec1Offset1;
+ float _Spec1JitterStrength1;
+ float _Spec2Smoothness1;
+ float _Spec2Offset1;
+ float _Spec2JitterStrength1;
+ float _AnisoUseTangentMap1;
+ float _AnisoSpec1Alpha1;
+ float _AnisoSpec2Alpha1;
+ float _SpecularInvertSmoothness1;
+ half _SpecularMetallic1;
+ // Toon
+ half4 _SpecularToonInnerOuter1;
+ fixed _SpecularToonStart1, _SpecularToonEnd1;
+
+ UnityIndirect ZeroIndirect()
+ {
+ UnityIndirect ind;
+ ind.diffuse = 0;
+ ind.specular = 0;
+ return ind;
+ }
+
+ // From unity just putting it here in case I want to mod it
+ half4 poiRealisticSpecular(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness,
+ float3 normal, float3 halfDir,
+ UnityLight light, UnityIndirect gi)
+ {
+ float perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness);
+ #define UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV 0
+
+ #if UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV
+ half shiftAmount = dot(normal, poiCam.viewDir);
+ normal = shiftAmount < 0.0f ? normal + poiCam.viewDir * (-shiftAmount + 1e-5f): normal;
+ float nv = saturate(dot(normal, poiCam.viewDir));
+ #else
+ half nv = abs(dot(normal, poiCam.viewDir));
+ #endif
+
+ float nl = saturate(dot(normal, light.dir));
+ float nh = saturate(dot(normal, halfDir));
+
+ half lv = saturate(dot(light.dir, poiCam.viewDir));
+ half lh = saturate(dot(light.dir, halfDir));
+
+ half diffuseTerm = DisneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;
+
+ float roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
+
+ roughness = max(roughness, 0.002);
+ float V = SmithJointGGXVisibilityTerm(nl, nv, roughness);
+ float D = GGXTerm(nh, roughness);
+
+ float specularTerm = V * D * UNITY_PI;
+
+ #ifdef UNITY_COLORSPACE_GAMMA
+ specularTerm = sqrt(max(1e-4h, specularTerm));
+ #endif
+
+ specularTerm = max(0, specularTerm * nl);
+ #if defined(_POI_SPECULARHIGHLIGHTS_OFF)
+ specularTerm = 0.0;
+ #endif
+
+ half surfaceReduction;
+ #ifdef UNITY_COLORSPACE_GAMMA
+ surfaceReduction = 1.0 - 0.28 * roughness * perceptualRoughness;
+ #else
+ surfaceReduction = 1.0 / (roughness * roughness + 1.0);
+ #endif
+
+ specularTerm *= any(specColor) ? 1.0: 0.0;
+
+ half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity));
+ half3 color = diffColor * (gi.diffuse + light.color * diffuseTerm)
+ + specularTerm * light.color * FresnelTerm(specColor, lh)
+ + surfaceReduction * gi.specular * FresnelLerp(specColor, grazingTerm, nv);
+
+ return half4(color, 1);
+ }
+
+ half3 calculateRealisticSpecular(float4 albedo, float2 uv, float4 specularTint, float specularSmoothness, float invertSmoothness, float mixAlbedoWithTint, float4 specularMap, float3 specularLight, float3 normal, float attenuation, float3 lightDirection, float nDotL, float3 halfDir)
+ {
+ half oneMinusReflectivity;
+ half3 finalSpecular;
+ UnityLight unityLight;
+ unityLight.color = specularLight;
+ unityLight.dir = lightDirection;
+ unityLight.ndotl = nDotL;
+
+ UNITY_BRANCH
+ if (_SmoothnessFrom == 0)
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specularMap.rgb * specularTint.rgb, /*out*/ oneMinusReflectivity);
+ finalSpecular = poiRealisticSpecular(diffColor, specularMap.rgb, oneMinusReflectivity, specularMap.a * specularSmoothness * lerp(1, -1, invertSmoothness), normal, halfDir, unityLight, ZeroIndirect());
+ }
+ else
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specularTint.rgb, /*out*/ oneMinusReflectivity);
+ float smoothness = max(max(specularMap.r, specularMap.g), specularMap.b);
+ finalSpecular = poiRealisticSpecular(diffColor, 1, oneMinusReflectivity, smoothness * specularSmoothness * lerp(1, -1, invertSmoothness), normal, halfDir, unityLight, ZeroIndirect());
+ }
+ finalSpecular *= lerp(1, albedo.rgb, mixAlbedoWithTint);
+ return finalSpecular;
+ }
+
+ half3 calculateToonSpecular(float4 albedo, float2 uv, float2 specularToonInnerOuter, float specularMixAlbedoIntoTint, float smoothnessFrom, float4 specularMap, float3 specularLight, float3 normal, float3 halfDir, float attenuation)
+ {
+ half3 finalSpecular = smoothstep(1 - specularToonInnerOuter.y, 1 - specularToonInnerOuter.x, dot(halfDir, normal) * lerp(1, attenuation, _SpecularAttenuation)) * specularLight;
+ UNITY_BRANCH
+ if (smoothnessFrom == 0)
+ {
+ finalSpecular.rgb *= specularMap.rgb * lerp(1, albedo.rgb, specularMixAlbedoIntoTint);
+ finalSpecular *= specularMap.a;
+ }
+ else
+ {
+ finalSpecular *= specularMap.r * lerp(1, albedo.rgb, specularMixAlbedoIntoTint);
+ }
+ return finalSpecular;
+ }
+
+ float3 strandSpecular(float TdotL, float TdotV, float specPower, float nDotL)
+ {
+ #if defined(POINT) || defined(SPOT)
+ nDotL *= poiLight.attenuation * poiLight.additiveShadow;
+ #endif
+ float Specular = saturate(nDotL) * pow(saturate(sqrt(1.0 - (TdotL * TdotL)) * sqrt(1.0 - (TdotV * TdotV)) - TdotL * TdotV), specPower);
+ half normalization = sqrt((specPower + 1) * ((specPower) + 1)) / (8 * pi);
+ Specular *= normalization;
+ return Specular;
+ }
+
+ half3 AnisotropicSpecular(
+ float specWhatTangent, float anisoUseTangentMap, float specularSmoothness, float spec2Smoothness,
+ float anisoSpec1Alpha, float anisoSpec2Alpha, float4 specularTint, float specularMixAlbedoIntoTint, float4 specularMap, float3 specularLight, float3 lightDirection, float3 halfDir, float nDotL, float jitter, float4 packedTangentMap)
+ {
+ float3 tangentOrBinormal = specWhatTangent ? poiMesh.tangent: poiMesh.binormal;
+
+
+ float3 normalLocalAniso = lerp(float3(0, 0, 1), UnpackNormal(packedTangentMap), anisoUseTangentMap);
+ normalLocalAniso = BlendNormals(normalLocalAniso, poiMesh.tangentSpaceNormal);
+ //float3 normalDirection = normalize(mul(poiMesh.normals[_SpecularNormal], poiTData.tangentTransform));
+ float3 normalDirectionAniso = Unity_SafeNormalize(mul(normalLocalAniso, poiTData.tangentTransform));
+ float3 tangentDirection = mul(poiTData.tangentTransform, tangentOrBinormal).xyz;
+ float3 viewReflectDirectionAniso = reflect(-poiCam.viewDir, normalDirectionAniso); // possible bad negation
+ float3 tangentDirectionMap = mul(poiTData.tangentToWorld, float3(normalLocalAniso.rg, 0.0)).xyz;
+ tangentDirectionMap = normalize(lerp(tangentOrBinormal, tangentDirectionMap, anisoUseTangentMap));
+
+ tangentDirectionMap += _Spec1Offset +jitter;
+
+ float TdotL = dot(lightDirection, tangentDirectionMap);
+ float TdotV = dot(poiCam.viewDir, tangentDirectionMap);
+ float TdotH = dot(halfDir, tangentDirectionMap);
+ half specPower = RoughnessToSpecPower(1.0 - specularSmoothness * specularMap.a);
+ half spec2Power = RoughnessToSpecPower(1.0 - spec2Smoothness * specularMap.a);
+ half Specular = 0;
+
+ float3 spec = strandSpecular(TdotL, TdotV, specPower, nDotL) * anisoSpec1Alpha;
+ float3 spec2 = strandSpecular(TdotL, TdotV, spec2Power, nDotL) * anisoSpec2Alpha;
+
+ return max(spec, spec2) * specularMap.rgb * specularTint.a * specularLight * lerp(1, albedo.rgb, specularMixAlbedoIntoTint);
+ }
+
+ inline float3 toonAnisoSpecular(float specWhatTangent, float anisoUseTangentMap, float3 lightDirection, float halfDir, float4 specularMap, float nDotL, fixed gradientStart, fixed gradientEnd, float4 specColor, float4 finalColor, fixed metallic, float jitter, float mirrored, float4 packedTangentMap)
+ {
+ float3 tangentOrBinormal = specWhatTangent ? poiMesh.tangent: poiMesh.binormal;
+
+ float3 normalLocalAniso = lerp(float3(0, 0, 1), UnpackNormal(packedTangentMap), anisoUseTangentMap);
+ normalLocalAniso = BlendNormals(normalLocalAniso, poiMesh.tangentSpaceNormal);
+ //float3 normalDirection = normalize(mul(poiMesh.normals[_SpecularNormal], poiTData.tangentTransform));
+ float3 normalDirectionAniso = Unity_SafeNormalize(mul(normalLocalAniso, poiTData.tangentTransform));
+ float3 tangentDirection = mul(poiTData.tangentTransform, tangentOrBinormal).xyz;
+ float3 viewReflectDirectionAniso = reflect(-poiCam.viewDir, normalDirectionAniso); // possible bad negation
+ float3 tangentDirectionMap = mul(poiTData.tangentToWorld, float3(normalLocalAniso.rg, 0.0)).xyz;
+ tangentDirectionMap = normalize(lerp(tangentOrBinormal, tangentDirectionMap, anisoUseTangentMap));
+
+ if (!mirrored)
+ {
+ tangentDirectionMap += jitter;
+ }
+
+ float TdotL = dot(lightDirection, tangentDirectionMap);
+ float TdotV = dot(poiCam.viewDir, tangentDirectionMap);
+ float TdotH = dot(halfDir, tangentDirectionMap);
+
+ float specular = saturate(sqrt(1.0 - (TdotL * TdotL)) * sqrt(1.0 - (TdotV * TdotV)) - TdotL * TdotV);
+
+ fixed smoothAlpha = specular;
+ if(mirrored)
+ {
+ smoothAlpha = max(specular - jitter, 0);
+ }
+
+ specular = smoothstep(gradientStart, gradientEnd, smoothAlpha);
+
+ /*
+ UNITY_BRANCH
+ if(_CenterOutSpecColor)
+ {
+ specularMap = POI2D_SAMPLER_PAN(_SpecularMap, _MainTex, clamp(float2(specular, specular), 0.01, .99), _SpecularMapPan);
+ }
+ */
+
+ #if defined(POINT) || defined(SPOT)
+ nDotL *= poiLight.attenuation * poiLight.additiveShadow;
+ #endif
+
+ return saturate(nDotL) * specular * poiLight.color * specColor * specularMap.rgb * lerp(1, finalColor, metallic) * specularMap.a;
+ }
+
+ inline float SpecularHQ(half roughness, half dotNH, half dotLH)
+ {
+ roughness = saturate(roughness);
+ roughness = max((roughness * roughness), 0.002);
+ half roughnessX2 = roughness * roughness;
+
+ half denom = dotNH * dotNH * (roughnessX2 - 1.0) + 1.0f;
+ half D = roughnessX2 / (3.14159 * denom * denom);
+
+ half k = roughness / 2.0f;
+ half k2 = k * k;
+ half invK2 = 1.0f - k2;
+
+ half vis = rcp(dotLH * dotLH * invK2 + k2);
+
+ float specTerm = vis * D;
+
+ return specTerm;
+ }
+
+ float3 calculateNewSpecular(in float3 specularMap, uint colorFrom, in float4 albedo, in float3 specularTint, in float specularMetallic, in float specularSmoothness, in half dotNH, in half dotLH, in float3 lightColor, in float attenuation)
+ {
+ float3 specColor = specularTint;
+ float metallic = specularMetallic;
+ float roughness = 1 - specularSmoothness;
+ float perceptualRoughness = roughness;
+ //float reflectInverse = DielectricSpec.a - metallic * DielectricSpec.a;
+ //float reflectivity = 1.0h - reflectInverse;
+ float3 specMapColor = lerp(specularMap, 1, colorFrom);
+ float3 specularColor = lerp(DielectricSpec.rgb * specMapColor, lerp(specularMap, albedo.rgb, colorFrom), metallic);
+ //albedo.rgb *= reflectInverse;
+
+ return specularColor * lightColor * attenuation * specularTint * SpecularHQ(perceptualRoughness, dotNH, dotLH);
+ }
+
+ float3 calculateSpecular(in float4 albedo)
+ {
+ half3 finalSpecular = 0;
+ half3 finalSpecular1 = 0;
+ float4 realisticAlbedo = albedo;
+ float4 realisticAlbedo1 = albedo;
+ float4 specularMap = POI2D_SAMPLER_PAN(_SpecularMap, _MainTex, poiMesh.uv[_SpecularMapUV], _SpecularMapPan);
+ half specularMask = POI2D_SAMPLER_PAN(_SpecularMask, _MainTex, poiMesh.uv[_SpecularMaskUV], _SpecularMaskPan).r;
+ float attenuation = poiLight.attenuation;
+
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+ {
+ if (_SmoothnessFrom == 1)
+ {
+ specularMap.a = specularMap.r;
+ specularMap.rgb = 1;
+ }
+
+ if(_SpecularInvertSmoothness)
+ {
+ specularMap.a = 1 - specularMap.a;
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, _SpecularMetallic, _SpecularSmoothness * specularMap.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, saturate(poiLight.nDotL) * lerp(1, attenuation, _SpecularAttenuation));
+ #else
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, _SpecularMetallic, _SpecularSmoothness * specularMap.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, lerp(1, attenuation, _SpecularAttenuation));
+ #endif
+ }
+
+ UNITY_BRANCH
+ if(_SpecularType == 4)
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacroUV]), _SpecularAnisoJitterMacroPan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier;
+ jitter += _Spec1Offset;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[_AnisoTangentMapUV], _AnisoTangentMapPan);
+
+ finalSpecular += toonAnisoSpecular(_SpecWhatTangent, _AnisoUseTangentMap, poiLight.direction, poiLight.halfDir, specularMap, poiLight.nDotL, _SpecularToonStart, _SpecularToonEnd, _SpecularTint, albedo, _SpecularMetallic, jitter, _SpecularAnisoJitterMirrored, packedTangentMap);
+ finalSpecular *= lerp(1, poiLight.attenuation, _SpecularAttenuation);
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if(_SpecularType == 2) // Toon
+ {
+ finalSpecular += calculateToonSpecular(albedo, poiMesh.uv[0], _SpecularToonInnerOuter, _SpecularMetallic, _SmoothnessFrom, specularMap, poiLight.color, poiMesh.normals[_SpecularNormal], poiLight.halfDir, poiLight.attenuation);
+ finalSpecular *= _SpecularTint;
+ }
+ UNITY_BRANCH
+ if (_SpecularType == 3) // anisotropic
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacroUV]), _SpecularAnisoJitterMacroPan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier;
+ jitter += _Spec1Offset;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[_AnisoTangentMapUV], _AnisoTangentMapPan);
+
+ finalSpecular += AnisotropicSpecular(_SpecWhatTangent, _AnisoUseTangentMap, _SpecularSmoothness, _Spec2Smoothness, _AnisoSpec1Alpha, _AnisoSpec2Alpha, _SpecularTint, _SpecularMetallic, specularMap, poiLight.color, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap);
+ finalSpecular *= _SpecularTint;
+ finalSpecular *= lerp(1, poiLight.attenuation, _SpecularAttenuation);
+ }
+ #endif
+
+ #ifdef VERTEXLIGHT_ON
+ // Non Important Lights
+ for (int index = 0; index < 4; index ++)
+ {
+ attenuation = poiLight.vAttenuationDotNL[index];
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+ {
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, _SpecularMetallic, _SpecularSmoothness * specularMap.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]);
+ }
+ }
+ #endif
+
+ finalSpecular *= _SpecularTint.a;
+ finalSpecular = finalSpecular.rgb;
+ finalSpecular *= specularMask;
+
+ UNITY_BRANCH
+ if (_EnableSpecular1)
+ {
+ float4 specularMap1 = POI2D_SAMPLER_PAN(_SpecularMap1, _MainTex, poiMesh.uv[_SpecularMap1UV], _SpecularMap1Pan);
+ half specularMask1 = POI2D_SAMPLER_PAN(_SpecularMask1, _MainTex, poiMesh.uv[_SpecularMask1UV], _SpecularMask1Pan).r;
+ float attenuation = poiLight.attenuation;
+ UNITY_BRANCH
+ if(_SpecularType1 == 1) // Realistic
+ {
+ UNITY_BRANCH
+ if (_SmoothnessFrom1 == 1)
+ {
+ specularMap1.a = specularMap1.r;
+ specularMap1.rgb = 1;
+ }
+ else
+ {
+ realisticAlbedo1.rgb = specularMap1.rgb;
+ }
+
+ UNITY_BRANCH
+ if(_SpecularInvertSmoothness1)
+ {
+ specularMap1.a = 1 - specularMap1.a;
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ finalSpecular1 = calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, _SpecularMetallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, saturate(poiLight.nDotL) * lerp(1, attenuation, _SpecularAttenuation1));
+ #else
+ finalSpecular1 = calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, _SpecularMetallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.dotNH, poiLight.dotLH, poiLight.color, lerp(1, attenuation, _SpecularAttenuation1));
+ #endif
+ }
+
+ UNITY_BRANCH
+ if(_SpecularType1 == 4)
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored1) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier1;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacro1UV]), _SpecularAnisoJitterMacro1Pan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier1;
+ jitter += _Spec1Offset1;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[_AnisoTangentMap1UV], _AnisoTangentMap1Pan);
+
+ finalSpecular1 += toonAnisoSpecular(_SpecWhatTangent1, _AnisoUseTangentMap1, poiLight.direction, poiLight.halfDir, specularMap1, poiLight.nDotL, _SpecularToonStart1, _SpecularToonEnd1, _SpecularTint1, albedo, _SpecularMetallic1, jitter, _SpecularAnisoJitterMirrored1, packedTangentMap);
+ finalSpecular1 *= lerp(1, poiLight.attenuation, _SpecularAttenuation1);
+ }
+
+ UNITY_BRANCH
+ if(_SpecularType1 == 2) // Toon
+ {
+ finalSpecular1 = calculateToonSpecular(albedo, poiMesh.uv[0], _SpecularToonInnerOuter1, _SpecularMetallic1, _SmoothnessFrom1, specularMap1, poiLight.color, poiMesh.normals[_SpecularNormal1], poiLight.halfDir, poiLight.attenuation);
+ finalSpecular1 *= _SpecularTint1;
+ }
+ UNITY_BRANCH
+ if (_SpecularType1 == 3) // anisotropic
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored1) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier1;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacro1UV]), _SpecularAnisoJitterMacro1Pan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier1;
+ jitter += _Spec1Offset1;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[_AnisoTangentMap1UV], _AnisoTangentMap1Pan);
+
+ finalSpecular1 = AnisotropicSpecular(_SpecWhatTangent1, _AnisoUseTangentMap1, _SpecularSmoothness1, _Spec2Smoothness1, _AnisoSpec1Alpha1, _AnisoSpec2Alpha1, _SpecularTint1, _SpecularMetallic1, specularMap1, poiLight.color, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap);
+ finalSpecular1 *= _SpecularTint1;
+ finalSpecular1 *= lerp(1, poiLight.attenuation, _SpecularAttenuation1);
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ // Non Important Lights
+ #ifdef VERTEXLIGHT_ON
+ for (int index = 0; index < 4; index ++)
+ {
+ attenuation = poiLight.vAttenuationDotNL[index];
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+ {
+ finalSpecular1 += calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, _SpecularMetallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]);
+ }
+ }
+ #endif
+ #endif
+
+ finalSpecular1 *= _SpecularTint1.a;
+ finalSpecular1 = finalSpecular1.rgb;
+ finalSpecular1 *= specularMask1;
+ }
+ return finalSpecular + finalSpecular1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpecular.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpecular.cginc.meta
new file mode 100644
index 00000000..3644c1ea
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSpecular.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0b4e6cd954964f744a6d8f3110065276
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSubsurfaceScattering.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSubsurfaceScattering.cginc
new file mode 100644
index 00000000..baba1bd9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSubsurfaceScattering.cginc
@@ -0,0 +1,28 @@
+#ifndef SUBSURFACE
+ #define SUBSURFACE
+
+ float _SSSThicknessMod;
+ float _SSSSCale;
+ float _SSSPower;
+ float _SSSDistortion;
+ float4 _SSSColor;
+ float _EnableSSS;
+
+ POI_TEXTURE_NOSAMPLER(_SSSThicknessMap);
+
+ float3 calculateSubsurfaceScattering()
+ {
+ float SSS = 1 - POI2D_SAMPLER_PAN(_SSSThicknessMap, _MainTex, poiMesh.uv[_SSSThicknessMapUV], _SSSThicknessMapPan);
+
+ half3 vLTLight = poiLight.direction + poiMesh.normals[0] * _SSSDistortion;
+ half flTDot = pow(saturate(dot(poiCam.viewDir, -vLTLight)), _SSSPower) * _SSSSCale;
+ #ifdef FORWARD_BASE_PASS
+ half3 fLT = (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #else
+ half3 fLT = poiLight.attenuation * (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #endif
+
+ return fLT * poiLight.color * _SSSColor;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSubsurfaceScattering.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSubsurfaceScattering.cginc.meta
new file mode 100644
index 00000000..cdc51853
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiSubsurfaceScattering.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c069b0b0fa3d8f541a70acaee373e479
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiTessellation.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiTessellation.cginc
new file mode 100644
index 00000000..a35f940f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiTessellation.cginc
@@ -0,0 +1,117 @@
+#ifndef POI_TESSELLATION
+ #define POI_TESSELLATION
+
+ float _TessellationPhongStrength;
+ float _TessellationEdgeLength;
+ float _TessellationExtrusionAmount;
+ float _TessellationUniform;
+
+ struct TessellationControlPoint
+ {
+ float4 vertex: INTERNALTESSPOS;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float4 color: COLOR;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ };
+
+ struct TessellationFactors
+ {
+ float edge[3]: SV_TessFactor;
+ float inside: SV_InsideTessFactor;
+ };
+
+ TessellationControlPoint poiTessellationVert(appdata v)
+ {
+ TessellationControlPoint p;
+ p.vertex = v.vertex;
+ p.normal = v.normal;
+ p.tangent = v.tangent;
+ p.color = v.color;
+ p.uv0 = v.uv0;
+ p.uv1 = v.uv1;
+ p.uv2 = v.uv2;
+ p.uv3 = v.uv3;
+ return p;
+ }
+
+ float TessellationEdgeFactor(float3 p0, float3 p1)
+ {
+ #ifndef _FADING_ON
+ float edgeLength = distance(p0, p1);
+
+ float3 edgeCenter = (p0 + p1) * 0.5;
+ float viewDistance = distance(edgeCenter, _WorldSpaceCameraPos);
+
+ return edgeLength * _ScreenParams.y /
+ (_TessellationEdgeLength * viewDistance);
+ #else
+ return _TessellationUniform;
+ #endif
+ }
+
+ TessellationFactors poiPatchConst(
+ InputPatch < TessellationControlPoint, 3 > patch
+ )
+ {
+
+ TessellationFactors f;
+ float3 p0 = mul(unity_ObjectToWorld, patch[0].vertex).xyz;
+ float3 p1 = mul(unity_ObjectToWorld, patch[1].vertex).xyz;
+ float3 p2 = mul(unity_ObjectToWorld, patch[2].vertex).xyz;
+ f.edge[0] = TessellationEdgeFactor(p1, p2);
+ f.edge[1] = TessellationEdgeFactor(p2, p0);
+ f.edge[2] = TessellationEdgeFactor(p0, p1);
+ f.inside = (TessellationEdgeFactor(p1, p2) +
+ TessellationEdgeFactor(p2, p0) +
+ TessellationEdgeFactor(p0, p1)) * (1 / 3.0);
+ return f;
+ }
+
+ [UNITY_domain("tri")]
+ [UNITY_outputcontrolpoints(3)]
+ [UNITY_outputtopology("triangle_cw")]
+ [UNITY_partitioning("fractional_odd")]
+ [UNITY_patchconstantfunc("poiPatchConst")]
+ TessellationControlPoint poiHull(
+ InputPatch < TessellationControlPoint, 3 > patch,
+ uint id: SV_OutputControlPointID
+ )
+ {
+ return patch[id];
+ }
+
+ [UNITY_domain("tri")]
+ v2f poiDomain(
+ TessellationFactors factors,
+ OutputPatch < TessellationControlPoint, 3 > patch,
+ float3 barycentricCoordinates: SV_DomainLocation
+ )
+ {
+ appdata data;
+
+ #define MY_DOMAIN_PROGRAM_INTERPOLATE(fieldName) data.fieldName = patch[0].fieldName * barycentricCoordinates.x + patch[1].fieldName * barycentricCoordinates.y + patch[2].fieldName * barycentricCoordinates.z;
+
+ MY_DOMAIN_PROGRAM_INTERPOLATE(vertex)
+ float3 pp[3];
+ for (int i = 0; i < 3; ++ i)
+ {
+ pp[i] = data.vertex.xyz - patch[i].normal * (dot(data.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal));
+ }
+ data.vertex.xyz = _TessellationPhongStrength * (pp[0] * barycentricCoordinates.x + pp[1] * barycentricCoordinates.y + pp[2] * barycentricCoordinates.z) + (1.0f - _TessellationPhongStrength) * data.vertex.xyz;
+ MY_DOMAIN_PROGRAM_INTERPOLATE(normal)
+ data.vertex.xyz += data.normal.xyz * _TessellationExtrusionAmount;
+ MY_DOMAIN_PROGRAM_INTERPOLATE(tangent)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(color)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv0)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv1)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv2)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv3)
+
+ return vert(data);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiTessellation.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiTessellation.cginc.meta
new file mode 100644
index 00000000..47732023
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiTessellation.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 043e5afe2fc90c44bbd9e01944cafa1a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiUVDistortion.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiUVDistortion.cginc
new file mode 100644
index 00000000..5615695a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiUVDistortion.cginc
@@ -0,0 +1,22 @@
+#ifndef POI_UV_DISTORTION
+ #define POI_UV_DISTORTION
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture); float4 _DistortionFlowTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture1); float4 _DistortionFlowTexture1_ST;
+
+ float _DistortionStrength;
+ float _DistortionStrength1;
+ float2 _DistortionSpeed;
+ float2 _DistortionSpeed1;
+
+ float2 calculateDistortionUV(float2 uv)
+ {
+ _DistortionStrength *= .1;
+ float4 flowVector = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture) + _Time.x * _DistortionSpeed) * 2 - 1;
+ float4 flowVector1 = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture1, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture1) + _Time.x * _DistortionSpeed1) * 2 - 1;
+ flowVector *= _DistortionStrength;
+ flowVector1 *= _DistortionStrength1;
+ return uv + (flowVector.xy + flowVector1.xy) / 2;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiUVDistortion.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiUVDistortion.cginc.meta
new file mode 100644
index 00000000..ec29b511
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiUVDistortion.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c9b4d7ab88c2e8d4b8f84f0a57b9ca97
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiV2F.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiV2F.cginc
new file mode 100644
index 00000000..075a64d4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiV2F.cginc
@@ -0,0 +1,34 @@
+#ifndef POI_V2F
+ #define POI_V2F
+
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ float4 uv0: TEXCOORD0;
+ float4 uv1: TEXCOORD1;
+ float3 normal: TEXCOORD2;
+ float3 tangentViewDir: TEXCOORD3;
+ float4 tangent: TEXCOORD4;
+ float4 worldPos: TEXCOORD5;
+ float4 localPos: TEXCOORD6;
+ float4 grabPos: TEXCOORD7;
+ float3 barycentricCoordinates: TEXCOORD8;
+ #if defined(GRAIN)
+ float4 screenPos: TEXCOORD9;
+ #endif
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ float4 lightmapUV: TEXCOORD10;
+ #endif
+ float3 modelPos: TEXCOORD11;
+ float angleAlpha: TEXCOORD12;
+ float4 vertexColor: TEXCOORD14;
+ #ifdef FUR
+ float furAlpha: TEXCOORD15;
+ #endif
+ UNITY_SHADOW_COORDS(16)
+ UNITY_FOG_COORDS(17)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiV2F.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiV2F.cginc.meta
new file mode 100644
index 00000000..d931361d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiV2F.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6eafb5dcd4b16844cbc2af812d50c74f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVert.cginc
new file mode 100644
index 00000000..2b2aaf90
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVert.cginc
@@ -0,0 +1,107 @@
+#ifndef POI_VERT
+ #define POI_VERT
+
+ uint _VertexManipulationHeightUV;
+ float _VertexUnwrap;
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ #ifdef _COLOROVERLAY_ON
+ v.vertex.xyz = lerp(v.vertex.xyz, float3(v.uv0.x - .5, v.uv0.y - .5, 0), _VertexUnwrap);
+ #endif
+ applyLocalVertexTransformation(v.normal, v.tangent, v.vertex);
+
+
+ UNITY_INITIALIZE_OUTPUT(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef _REQUIRE_UV2 //POI_MIRROR
+ applyMirrorRenderVert(v.vertex);
+ #endif
+
+ TANGENT_SPACE_ROTATION;
+ o.localPos = v.vertex;
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ //o.localPos.x *= -1;
+ //o.localPos.xz += sin(o.localPos.y * 100 + _Time.y * 5) * .0025;
+
+ float2 uvToUse = 0;
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 0)
+ {
+ uvToUse = v.uv0.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 1)
+ {
+ uvToUse = v.uv1.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 2)
+ {
+ uvToUse = v.uv2.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 3)
+ {
+ uvToUse = v.uv3.xy;
+ }
+
+ applyWorldVertexTransformation(o.worldPos, o.localPos, o.normal, uvToUse);
+ applyVertexGlitching(o.worldPos, o.localPos);
+ applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy);
+ applyVertexRounding(o.worldPos, o.localPos);
+ o.pos = UnityObjectToClipPos(o.localPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.uv0.xy = v.uv0.xy;
+ o.uv0.zw = v.uv1.xy;
+ o.uv1.xy = v.uv2.xy;
+ o.uv1.zw = v.uv3.xy;
+ o.vertexColor = v.color;
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
+
+ #ifdef POI_BULGE
+ bulgyWolgy(o);
+ #endif
+
+ #if defined(GRAIN)
+ o.screenPos = ComputeScreenPos(o.pos);
+ #endif
+
+ o.angleAlpha = 1;
+ #ifdef _SUNDISK_NONE //POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+ #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
+
+ UNITY_TRANSFER_SHADOW(o, o.uv0.xy);
+ UNITY_TRANSFER_FOG(o, o.pos);
+
+ #if defined(_PARALLAXMAP) // POI_PARALLAX
+ v.tangent.xyz = normalize(v.tangent.xyz);
+ v.normal = normalize(v.normal);
+ float3x3 objectToTangent = float3x3(
+ v.tangent.xyz,
+ cross(v.normal, v.tangent.xyz) * v.tangent.w,
+ v.normal
+ );
+ o.tangentViewDir = mul(objectToTangent, ObjSpaceViewDir(v.vertex));
+ #endif
+
+ #ifdef POI_META_PASS
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ return o;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVert.cginc.meta
new file mode 100644
index 00000000..81ea7bac
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d894e5c87ba80eb4697485aac0e68da3
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVertexManipulations.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVertexManipulations.cginc
new file mode 100644
index 00000000..7d7e15f0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVertexManipulations.cginc
@@ -0,0 +1,97 @@
+#ifndef POI_VERTEX_MANIPULATION
+ #define POI_VERTEX_MANIPULATION
+
+ #include "CGI_PoiMath.cginc"
+
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+
+ float _VertexManipulationHeight;
+ float _VertexManipulationHeightBias;
+ sampler2D _VertexManipulationHeightMask; float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightPan;
+
+
+ //Vertex Glitching
+ float _EnableVertexGlitch;
+ sampler2D _VertexGlitchMap; float4 _VertexGlitchMap_ST;
+ float _VertexGlitchThreshold;
+ float _VertexGlitchFrequency;
+ float _VertexGlitchStrength;
+ // Rounding
+ float _VertexRoundingDivision;
+ float _VertexRoundingEnabled;
+
+ void applyLocalVertexTransformation(inout float3 normal, inout float4 tangent, inout float4 vertex)
+ {
+ #ifndef SIMPLE
+ normal = rotate_with_quaternion(normal, _VertexManipulationLocalRotation);
+ tangent.xyz = rotate_with_quaternion(tangent.xyz, _VertexManipulationLocalRotation);
+ vertex = transform(vertex, _VertexManipulationLocalTranslation, _VertexManipulationLocalRotation, _VertexManipulationLocalScale);
+
+ //vertex = float4(vertex.x + sin(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), vertex.y, vertex.z + cos(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), 1);
+ #endif
+ }
+
+ void applyLocalVertexTransformation(inout float3 normal, inout float4 vertex)
+ {
+ #ifndef SIMPLE
+ normal = rotate_with_quaternion(normal, _VertexManipulationLocalRotation);
+ vertex = transform(vertex, _VertexManipulationLocalTranslation, _VertexManipulationLocalRotation, _VertexManipulationLocalScale);
+
+ //vertex = float4(vertex.x + sin(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), vertex.y, vertex.z + cos(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), 1);
+ #endif
+ }
+
+ void applyWorldVertexTransformation(inout float4 worldPos, inout float4 localPos, inout float3 worldNormal, float2 uv)
+ {
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(TRANSFORM_TEX(uv, _VertexManipulationHeightMask) + _VertexManipulationHeightPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * _VertexManipulationHeight * worldNormal;
+ worldPos.rgb += _VertexManipulationWorldTranslation.xyz * _VertexManipulationWorldTranslation.w + heightOffset;
+ localPos.xyz = mul(unity_WorldToObject, worldPos);
+ }
+
+ void applyWorldVertexTransformationShadow(inout float4 worldPos, inout float4 localPos, float3 worldNormal, float2 uv)
+ {
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(TRANSFORM_TEX(uv, _VertexManipulationHeightMask) + _VertexManipulationHeightPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * _VertexManipulationHeight * worldNormal;
+ worldPos.rgb += _VertexManipulationWorldTranslation.xyz * _VertexManipulationWorldTranslation.w + heightOffset;
+ localPos.xyz = mul(unity_WorldToObject, worldPos);
+ }
+
+ void applyVertexRounding(inout float4 worldPos, inout float4 localPos)
+ {
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ worldPos.xyz = (ceil(worldPos * _VertexRoundingDivision) / _VertexRoundingDivision) - 1 / _VertexRoundingDivision * .5;
+ localPos = mul(unity_WorldToObject, worldPos);
+ }
+ }
+
+ void applyVertexGlitching(inout float4 worldPos, inout float4 localPos)
+ {
+ UNITY_BRANCH
+ if(_EnableVertexGlitch)
+ {
+ float3 forward = getCameraPosition() - mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ forward.y = 0;
+ forward = normalize(forward);
+ float3 glitchDirection = normalize(cross(float3(0, 1, 0), forward));
+ float glitchAmount = frac(sin(dot(_Time.xy + worldPos.y, float2(12.9898, 78.233))) * 43758.5453123) * 2 - 1;
+ /*
+ float uvl = worldPos.y * _VertexGlitchDensity + _Time.x * _VertexGlitchMapPanSpeed;
+ float uvr = worldPos.y * _VertexGlitchDensity - _Time.x * _VertexGlitchMapPanSpeed;
+ float glitchAmountLeft = tex2Dlod(_VertexGlitchMap, float4(uvl, uvl, 0, 0)).r;
+ float glitchAmountRight = -tex2Dlod(_VertexGlitchMap, float4(uvr, uvr, 0, 0)).r;
+ float glitchAmount = glitchAmountLeft + glitchAmountRight;
+ */
+ 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;
+ worldPos.xyz += glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * step(_VertexGlitchThreshold, randomGlitch);
+ localPos = mul(unity_WorldToObject, worldPos);
+ }
+ }
+
+#endif
+// \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVertexManipulations.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVertexManipulations.cginc.meta
new file mode 100644
index 00000000..8058cad2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVertexManipulations.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 2cc3aabeafa10fb40b40ce6bcbcffcd2
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVideo.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVideo.cginc
new file mode 100644
index 00000000..ad0b465c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVideo.cginc
@@ -0,0 +1,267 @@
+#ifndef POI_VIDEO
+ #define POI_VIDEO
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoPixelTexture); float4 _VideoPixelTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoMaskTexture); float4 _VideoMaskTexture_ST;
+
+ uint _VideoUVNumber;
+ uint _VideoType;
+ float3 pixels;
+ float2 _VideoResolution;
+ sampler2D _VideoGameboyRamp;
+ half _VideoBacklight;
+ half _VideoCRTRefreshRate;
+ half _VideoCRTPixelEnergizedTime;
+ half _VideoEnableVideoPlayer;
+ half _VideoRepeatVideoTexture;
+ half _VideoPixelateToResolution;
+ float2 _VideoMaskPanning;
+ // Video Settings
+ half _VideoSaturation;
+ half _VideoContrast;
+ float2 _VideoTiling;
+ float2 _VideoOffset;
+ float2 _VideoPanning;
+ //Debug
+ half _VideoEnableDebug;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoDebugTexture); float4 _VideoDebugTexture_ST;
+
+
+ sampler2D _VRChat_VideoPlayer;
+ float4 _VRChat_VideoPlayer_TexelSize;
+
+ float4 globalVideoPlayerColor;
+ float3 globalColorToDisplayOnScreen;
+ float globalVideoOn;
+ float3 globalVideoEmission;
+
+ float3 applyBacklight(float3 finalColor, half backlightStrength)
+ {
+ return max(backlightStrength, finalColor.rgb);
+ }
+
+ float3 applyViewAngleTN(float3 finalColor)
+ {
+ float3 reflectionVector = normalize(reflect(poiCam.viewDir.rgb, poiMesh.normals[1].rgb));
+ float upwardShift = dot(reflectionVector, poiMesh.binormal);
+ upwardShift = pow(upwardShift, 1);
+ float sideShift = dot(reflectionVector, poiMesh.tangent);
+ sideShift *= pow(sideShift, 3);
+ #if !UNITY_COLORSPACE_GAMMA
+ finalColor = LinearToGammaSpace(finalColor);
+ #endif
+ finalColor = saturate(lerp(half3(0.5, 0.5, 0.5), finalColor, upwardShift + 1));
+ #if !UNITY_COLORSPACE_GAMMA
+ finalColor = GammaToLinearSpace(finalColor);
+ #endif
+ finalColor = (lerp(finalColor, finalColor.gbr, sideShift));
+ return finalColor;
+ }
+
+ float calculateCRTPixelBrightness()
+ {
+ float totalPixels = _VideoResolution.x * _VideoResolution.y;
+ float2 uvPixel = float2((floor((1 - poiMesh.uv[_VideoUVNumber].y) * _VideoResolution.y)) / _VideoResolution.y, (floor(poiMesh.uv[_VideoUVNumber].x * _VideoResolution.x)) / _VideoResolution.x);
+ float currentPixelNumber = _VideoResolution.x * (_VideoResolution.y * uvPixel.x) + _VideoResolution.y * uvPixel.y;
+ float currentPixelAlpha = currentPixelNumber / totalPixels;
+ half electronBeamAlpha = frac(_Time.y * _VideoCRTRefreshRate);
+ float electronBeamPixelNumber = totalPixels * electronBeamAlpha;
+
+ float DistanceInPixelsFromCurrentElectronBeamPixel = 0;
+ if (electronBeamPixelNumber >= currentPixelNumber)
+ {
+ DistanceInPixelsFromCurrentElectronBeamPixel = electronBeamPixelNumber - currentPixelNumber;
+ }
+ else
+ {
+ DistanceInPixelsFromCurrentElectronBeamPixel = electronBeamPixelNumber + (totalPixels - currentPixelNumber);
+ }
+ float CRTFrameTime = 1 / _VideoCRTRefreshRate;
+ float timeSincecurrentPixelWasHitByElectronBeam = (DistanceInPixelsFromCurrentElectronBeamPixel / totalPixels);
+
+ return saturate(_VideoCRTPixelEnergizedTime - timeSincecurrentPixelWasHitByElectronBeam);
+ }
+
+ void applyContrastSettings(inout float3 pixel)
+ {
+ #if !UNITY_COLORSPACE_GAMMA
+ pixel = LinearToGammaSpace(pixel);
+ #endif
+ pixel = saturate(lerp(half3(0.5, 0.5, 0.5), pixel, _VideoContrast + 1));
+ #if !UNITY_COLORSPACE_GAMMA
+ 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 finalColor)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01);
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ finalColor.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight;
+ }
+ void calculateTN(inout float4 finalColor)
+ {
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01);
+ globalColorToDisplayOnScreen = applyViewAngleTN(globalColorToDisplayOnScreen);
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ finalColor.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight;
+ }
+ void calculateCRT(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ float brightness = calculateCRTPixelBrightness();
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ finalColor.rgb = globalColorToDisplayOnScreen * pixels * brightness * _VideoBacklight;
+ }
+ void calculateOLED(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ finalColor.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight;
+ }
+ void calculateGameboy(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ half brightness = saturate((globalColorToDisplayOnScreen.r + globalColorToDisplayOnScreen.g + globalColorToDisplayOnScreen.b) * .3333333);
+ finalColor.rgb = tex2D(_VideoGameboyRamp, brightness);
+ }
+ void calculateProjector(inout float4 finalColor, float4 finalColorBeforeLighting)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = finalColor;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+
+ float3 projectorColor = finalColorBeforeLighting * globalColorToDisplayOnScreen * _VideoBacklight;
+ finalColor.r = clamp(projectorColor.r, finalColor.r, 1000);
+ finalColor.g = clamp(projectorColor.g, finalColor.g, 1000);
+ finalColor.b = clamp(projectorColor.b, finalColor.b, 1000);
+ }
+
+ void applyScreenEffect(inout float4 finalColor, float4 finalColorBeforeLighting)
+ {
+ float4 finalColorBeforeScreen = finalColor;
+
+ pixels = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoPixelTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoPixelTexture) * _VideoResolution);
+ globalVideoOn = 0;
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 1)
+ {
+ float4 videoTexture = 0;
+ UNITY_BRANCH
+ if(_VideoPixelateToResolution)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableDebug)
+ {
+ videoTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoDebugTexture, _MainTex, round(TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoDebugTexture) * _VideoResolution + .5) / _VideoResolution);
+ }
+ else
+ {
+ videoTexture = tex2D(_VRChat_VideoPlayer, round(poiMesh.uv[_VideoUVNumber] * _VideoResolution + .5) / _VideoResolution);
+ }
+ }
+ else
+ {
+ UNITY_BRANCH
+ if(_VideoEnableDebug)
+ {
+ videoTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoDebugTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoDebugTexture) * _VideoTiling + _VideoOffset);
+ }
+ else
+ {
+ videoTexture = tex2D(_VRChat_VideoPlayer, ((poiMesh.uv[_VideoUVNumber] + _Time.x * _VideoPanning) * _VideoTiling) + _VideoOffset);
+ }
+ }
+ if(videoTexture.a == 1)
+ {
+ globalColorToDisplayOnScreen = videoTexture.rgb;
+ globalVideoOn = 1;
+ }
+ }
+
+ UNITY_BRANCH
+ if(_VideoRepeatVideoTexture == 1)
+ {
+ if(poiMesh.uv[_VideoUVNumber].x > 1 || poiMesh.uv[_VideoUVNumber].x < 0 || poiMesh.uv[_VideoUVNumber].y > 1 || poiMesh.uv[_VideoUVNumber].y < 0)
+ {
+ return;
+ }
+ }
+
+ switch(_VideoType)
+ {
+ case 0: // LCD
+ {
+ calculateLCD(finalColor);
+ break;
+ }
+ case 1: // TN
+ {
+ calculateTN(finalColor);
+ break;
+ }
+ case 2: // CRT
+ {
+ calculateCRT(finalColor);
+ break;
+ }
+ case 3: // OLED
+ {
+ calculateOLED(finalColor);
+ break;
+ }
+ case 4: // Gameboy
+ {
+ calculateGameboy(finalColor);
+ break;
+ }
+ case 5: // Projector
+ {
+ calculateProjector(finalColor, finalColorBeforeLighting);
+ break;
+ }
+ }
+
+ float screenMask = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoMaskTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoMaskTexture) + _Time.x * _VideoMaskPanning);
+ finalColor = lerp(finalColorBeforeScreen, finalColor, screenMask);
+ globalVideoEmission = finalColor.rgb;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVideo.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVideo.cginc.meta
new file mode 100644
index 00000000..c0049aae
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVideo.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 73d432c3d16bb244eb0b695b3603923e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVoronoi.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVoronoi.cginc
new file mode 100644
index 00000000..095c1c5c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVoronoi.cginc
@@ -0,0 +1,294 @@
+#ifndef POI_VORONOI
+ #define POI_VORONOI
+
+ #include "CGI_PoiRNG.cginc"
+
+ uint _VoronoiSpace;
+ uint _VoronoiBlend;
+ uint _VoronoiType;
+ float4 _VoronoiColor0;
+ float _VoronoiEmission0;
+ float4 _VoronoiColor1;
+ float _VoronoiEmission1;
+ float2 _VoronoiGradient;
+ float _VoronoiScale;
+ float3 _VoronoiSpeed;
+ int _VoronoiOctaveNumber;
+ float _VoronoiOctaveScale;
+ float _VoronoiOctaveAttenuation;
+ float _VoronoiEnableRandomCellColor;
+ float2 _VoronoiRandomMinMaxSaturation;
+ float2 _VoronoiRandomMinMaxBrightness;
+ float3 randomPoint;
+
+ POI_TEXTURE_NOSAMPLER(_VoronoiMask);
+ POI_TEXTURE_NOSAMPLER(_VoronoiNoise);
+ float _VoronoiNoiseIntensity;
+
+ float2 inoise(float3 P, float jitter)
+ {
+ float3 Pi = mod(floor(P), 289.0);
+ float3 Pf = frac(P);
+ float3 oi = float3(-1.0, 0.0, 1.0);
+ float3 of = float3(-0.5, 0.5, 1.5);
+ float3 px = Permutation(Pi.x + oi);
+ float3 py = Permutation(Pi.y + oi);
+
+ float3 p, ox, oy, oz, dx, dy, dz;
+ float2 F = 1e6;
+
+ for (int i = 0; i < 3; i ++)
+ {
+ for (int j = 0; j < 3; j ++)
+ {
+ p = Permutation(px[i] + py[j] + Pi.z + oi); // pij1, pij2, pij3
+
+ ox = frac(p * K) - Ko;
+ oy = mod(floor(p * K), 7.0) * K - Ko;
+
+ p = Permutation(p);
+
+ oz = frac(p * K) - Ko;
+
+ dx = Pf.x - of[i] + jitter * ox;
+ dy = Pf.y - of[j] + jitter * oy;
+ dz = Pf.z - of + 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 ++)
+ {
+ if (d[n] < F[0])
+ {
+ F[1] = F[0];
+ F[0] = d[n];
+ randomPoint = p;
+ }
+ else if(d[n] < F[1])
+ {
+ F[1] = d[n];
+ }
+ }
+ }
+ }
+
+ return F;
+ }
+
+ float voronoi2D(in float2 x, float scale, float2 speed)
+ {
+ 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;
+ for (int j = -1; j <= 1; j ++)
+ {
+ for (int i = -1; i <= 1; i ++)
+ {
+ 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;
+ mr = r;
+ mg = g;
+ randomPoint.xy = currentPoint;
+ }
+ }
+ }
+
+ // second pass: distance to borders
+ md = 8.0;
+ for (int r = -2; r <= 2; r ++)
+ {
+ for (int q = -2; q <= 2; q ++)
+ {
+ 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)));
+ }
+ }
+ }
+ return md;
+ }
+
+ float voronoi3D(in float3 x, float scale, float3 speed)
+ {
+ 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;
+ for (int j = -1; j <= 1; j ++)
+ {
+ for (int i = -1; i <= 1; i ++)
+ {
+ for (int h = -1; h <= 1; h ++)
+ {
+ 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;
+ mr = r;
+ mg = g;
+ randomPoint = currentPoint;
+ }
+ }
+ }
+ }
+
+ // second pass: distance to borders
+ md = 8.0;
+ for (int r = -2; r <= 2; r ++)
+ {
+ for (int q = -2; q <= 2; q ++)
+ {
+ for (int p = -2; p <= 2; p ++)
+ {
+ 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)));
+ }
+ }
+ }
+ }
+ 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)
+ {
+ float freq = scale;
+ float weight = 1.0f;
+ float sum = 0;
+ for (int i = 0; i < octaveNumber; i ++)
+ {
+ float2 F = inoise(p * freq + time * speed, jitter) * 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)
+ {
+ float freq = scale;
+ float weight = 1.0f;
+ float sum = 0;
+ for (int i = 0; i < octaveNumber; i ++)
+ {
+ float2 F = inoise(p * freq + time * speed, jitter) * weight;
+
+ sum += sqrt(F[1]) - sqrt(F[0]);
+
+ freq *= octaveScale;
+ weight *= 1.0f - octaveAttenuation;
+ }
+ return sum;
+ }
+
+ void applyVoronoi(inout float4 finalColor, inout float3 VoronoiEmission)
+ {
+ _VoronoiOctaveNumber = 1;
+ _VoronoiOctaveScale = 1;
+ _VoronoiOctaveAttenuation = 1;
+ randomPoint = 0;
+
+ float voronoi = 0;
+
+ float3 position = 0;
+
+ UNITY_BRANCH
+ if (_VoronoiSpace == 0)
+ {
+ position = poiMesh.localPos;
+ }
+ UNITY_BRANCH
+ if(_VoronoiSpace == 1)
+ {
+ position = poiMesh.worldPos;
+ }
+ UNITY_BRANCH
+ if(_VoronoiSpace == 2)
+ {
+ position = float3(poiMesh.uv[0].x, poiMesh.uv[0].y, 0);
+ }
+
+ float mask = POI2D_SAMPLER_PAN(_VoronoiMask, _MainTex, poiMesh.uv[_VoronoiMaskUV], _VoronoiMaskPan).r;
+ float edgeNoise = POI2D_SAMPLER_PAN(_VoronoiNoise, _MainTex, poiMesh.uv[_VoronoiNoiseUV], _VoronoiNoisePan).r * _VoronoiNoiseIntensity;
+
+ UNITY_BRANCH
+ if(_VoronoiType == 0) // Basic
+ {
+ voronoi = voronoi2D(position.xy, _VoronoiScale, _VoronoiSpeed);
+ }
+ UNITY_BRANCH
+ if (_VoronoiType == 1) // Diff
+ {
+ voronoi = VoronoiNoiseDiff_Octaves(position, _VoronoiScale, _VoronoiSpeed, _VoronoiOctaveNumber, _VoronoiOctaveScale, _VoronoiOctaveAttenuation, 1, _Time.x);
+ }
+ UNITY_BRANCH
+ if (_VoronoiType == 2) // Fixed Border
+ {
+ voronoi = voronoi3D(position, _VoronoiScale, _VoronoiSpeed);
+ // isolines
+ //color = c.x * (0.5 + 0.5 * sin(64.0 * c.x)) * 1.0;
+ }
+
+ if (_VoronoiEnableRandomCellColor == 1)
+ {
+ float3 rando = random3(randomPoint);
+ fixed hue = rando.x;
+ fixed saturation = lerp(_VoronoiRandomMinMaxSaturation.x, _VoronoiRandomMinMaxSaturation.y, rando.y);
+ fixed value = lerp(_VoronoiRandomMinMaxBrightness.x, _VoronoiRandomMinMaxBrightness.y, rando.z);
+ float3 hsv = float3(hue, saturation, value);
+ _VoronoiColor1.rgb = HSVtoRGB(hsv);
+ }
+ _VoronoiGradient.xy += edgeNoise;
+ float ramp = smoothstep(_VoronoiGradient.x, _VoronoiGradient.y, voronoi);
+
+ UNITY_BRANCH
+ if(_VoronoiBlend == 0)
+ {
+ float4 voronoiColor = lerp(_VoronoiColor0, _VoronoiColor1, ramp);
+ finalColor.rgb = lerp(finalColor.rgb, voronoiColor, mask * voronoiColor.a);
+ }
+ float4 voronoiEmissionColor = lerp(_VoronoiColor0 * _VoronoiEmission0, _VoronoiColor1 * _VoronoiEmission1, ramp);
+ VoronoiEmission = voronoiEmissionColor.rgb * mask * voronoiEmissionColor.a;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVoronoi.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVoronoi.cginc.meta
new file mode 100644
index 00000000..c735683f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiVoronoi.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 212232d5f3d506248b1bde8125d54656
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiWireframe.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiWireframe.cginc
new file mode 100644
index 00000000..f8c75c53
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiWireframe.cginc
@@ -0,0 +1,111 @@
+#ifndef POI_WIREFRAME
+ #define POI_WIREFRAME
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_WireframeTexture); float4 _WireframeTexture_ST;
+ float2 _WireframeTexturePan;
+ float _WireframeSmoothing;
+ float _WireframeThickness;
+ float4 _WireframeColor;
+ float _WireframeAlpha;
+ float _WireframeEnable;
+ float _WireframeWaveEnabled;
+ float _WireframeWaveDensity;
+ float _WireframeWaveSpeed;
+ float _WireframeEdgeOpacity;
+ float _WireframeFaceOpacity;
+ half _WireframeEmissionAlpha;
+ float _WireframeEmissionStrength;
+ float _WireframeQuad;
+ uint _WireframeUV;
+
+ #ifndef POI_SHADOW
+ void applyWireframe(inout float3 wireframeEmission, inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if (_WireframeEnable)
+ {
+ float4 colorMap = UNITY_SAMPLE_TEX2D_SAMPLER(_WireframeTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_WireframeUV], _WireframeTexture) + _Time.x * _WireframeTexturePan);
+ float size = _WireframeThickness;
+ half3 width = abs(ddx(poiMesh.barycentricCoordinates)) + abs(ddy(poiMesh.barycentricCoordinates));
+ half3 eF = smoothstep(0, width * size, poiMesh.barycentricCoordinates);
+ half minBary = size > 0 ? min(min(eF.x, eF.y), eF.z): 1;
+
+ float4 wireframeColor = _WireframeColor * colorMap;
+
+ albedo.a *= lerp(_WireframeEdgeOpacity, _WireframeFaceOpacity, minBary);
+ albedo.rgb = lerp(lerp(albedo.rgb, wireframeColor.rgb, wireframeColor.a), albedo.rgb, minBary);
+ wireframeEmission = wireframeColor.rgb * _WireframeEmissionStrength * (1 - minBary) * _WireframeColor.a;
+ }
+ }
+
+ [maxvertexcount(3)]
+ void wireframeGeom(triangle v2f IN[3], inout TriangleStream < v2f > tristream)
+ {
+ UNITY_BRANCH
+ if(_WireframeQuad)
+ {
+ float e1 = length(IN[0].localPos - IN[1].localPos);
+ float e2 = length(IN[1].localPos - IN[2].localPos);
+ float e3 = length(IN[2].localPos - IN[0].localPos);
+
+ float3 quad = 0;
+ if(e1 > e2 && e1 > e3)
+ quad.y = 1.;
+ else if(e2 > e3 && e2 > e1)
+ quad.x = 1;
+ else
+ quad.z = 1;
+
+ IN[0].barycentricCoordinates = fixed3(1, 0, 0) + quad;
+ IN[1].barycentricCoordinates = fixed3(0, 0, 1) + quad;
+ IN[2].barycentricCoordinates = fixed3(0, 1, 0) + quad;
+ }
+ else
+ {
+ IN[0].barycentricCoordinates = fixed3(1, 0, 0);
+ IN[1].barycentricCoordinates = fixed3(0, 1, 0);
+ IN[2].barycentricCoordinates = fixed3(0, 0, 1);
+ }
+
+
+
+ tristream.Append(IN[0]);
+ tristream.Append(IN[1]);
+ tristream.Append(IN[2]);
+ }
+ #else
+
+ float applyShadowWireframe(float2 uv, float3 barycentricCoordinates, float3 normal, float3 worldPos)
+ {
+ UNITY_BRANCH
+ if(_WireframeEnable)
+ {
+ float wireframeFadeAlpha = _WireframeAlpha;
+ float3 finalWireframeColor = 0;
+
+ float3 barys;
+ barys.xy = barycentricCoordinates;
+ barys.z = 1 - barys.x - barys.y;
+ float3 deltas = fwidth(barys);
+ float3 smoothing = deltas * _WireframeSmoothing;
+ float wireframeThickness = _WireframeThickness;
+ float3 thickness = deltas * wireframeThickness;
+ barys = smoothstep(thickness, thickness + smoothing, barys);
+ float minBary = min(barys.x, min(barys.y, barys.z));
+
+ return lerp(_WireframeEdgeOpacity, _WireframeFaceOpacity, minBary);
+ }
+ }
+
+ [maxvertexcount(3)]
+ void wireframeGeom(triangle V2FShadow IN[3], inout TriangleStream < V2FShadow > tristream)
+ {
+ IN[0].barycentricCoordinates = fixed3(1, 0, 0);
+ IN[1].barycentricCoordinates = fixed3(0, 1, 0);
+ IN[2].barycentricCoordinates = fixed3(0, 0, 1);
+ tristream.Append(IN[0]);
+ tristream.Append(IN[1]);
+ tristream.Append(IN[2]);
+ }
+ #endif
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiWireframe.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiWireframe.cginc.meta
new file mode 100644
index 00000000..854dfb4c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_PoiWireframe.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1dd724a69f3cb564587366df31afbda8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_Poicludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_Poicludes.cginc
new file mode 100644
index 00000000..f6128639
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_Poicludes.cginc
@@ -0,0 +1,176 @@
+#ifndef POICLUDES
+ #define POICLUDES
+
+ UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST; float4 _MainTex_TexelSize;
+ sampler2D _PoiGrab;
+ float _Clip;
+ float _AlphaMod;
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float4 color: COLOR;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+
+
+ #ifdef OUTLINE
+ float _LineWidth;
+ float _OutlineEmission;
+ float4 _LineColor;
+ sampler2D _OutlineTexture; float4 _OutlineTexture_ST;
+ float4 _OutlineTexturePan;
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+ #endif
+
+ struct PoiLighting
+ {
+ half3 direction;
+ half3 color;
+ fixed attenuation;
+ #if defined(POINT) || defined(SPOT)
+ fixed additiveShadow;
+ #endif
+ half3 directLighting;
+ half3 indirectLighting;
+ half lightMap;
+ half3 rampedLightMap;
+ half3 finalLighting;
+ half3 halfDir;
+ half nDotL;
+ half nDotH;
+ half lDotv;
+ half lDotH;
+ half nDotV;
+ half N0DotV;
+ half diffuseTerm;
+
+ // World normal dot half direction
+ #ifdef POI_VAR_DOTNH
+ half dotNH;
+ #endif
+
+ // Light direction dot half direction
+ #ifdef POI_VAR_DOTLH
+ half dotLH;
+ #endif
+
+ #ifdef VERTEXLIGHT_ON
+ // Non Important Lights
+ float4 vDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+
+ #ifdef POI_VAR_DOTLH
+ half4 vDotLH;
+ #endif
+
+ #ifdef POI_VAR_DOTNH
+ half4 vDotNH;
+ #endif
+
+ #endif
+ };
+
+ struct PoiCamera
+ {
+ half3 viewDir;
+ half3 tangentViewDir;
+ half3 forwardDir;
+ half3 worldPos;
+ float viewDotNormal;
+ float distanceToModel;
+ float distanceToVert;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float2 screenUV;
+ float4 clipPos;
+ #if defined(GRAIN)
+ float4 screenPos;
+ #endif
+ float4 grabPos;
+ };
+
+ struct PoiMesh
+ {
+ float3 normals[2];
+ float3 tangent;
+ float3 binormal;
+ float3 localPos;
+ float3 worldPos;
+ float3 modelPos;
+ float3 tangentSpaceNormal;
+ float2 uv[5];
+ float4 vertexColor;
+ fixed3 barycentricCoordinates;
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ float4 lightmapUV;
+ #endif
+ float isFrontFace;
+ #ifdef FUR
+ float furAlpha;
+ #endif
+ };
+
+ struct PoiTangentData
+ {
+ float3x3 tangentTransform;
+ float3x3 tangentToWorld;
+ };
+
+ struct FragmentCommonData
+ {
+ half3 diffColor, specColor;
+ // Note: smoothness & oneMinusReflectivity for optimization purposes, mostly for DX9 SM2.0 level.
+ // Most of the math is being done on these (1-x) values, and that saves a few precious ALU slots.
+ half oneMinusReflectivity, smoothness;
+ float3 normalWorld;
+ float3 eyeVec;
+ half alpha;
+ float3 posWorld;
+
+ #if UNITY_STANDARD_SIMPLE
+ half3 reflUVW;
+ #endif
+
+ #if UNITY_STANDARD_SIMPLE
+ half3 tangentSpaceNormal;
+ #endif
+ };
+
+ struct Debug
+ {
+ float debug1;
+ float2 debug2;
+ float3 debug3;
+ float4 debug4;
+ };
+
+ static Debug debug;
+ static PoiLighting poiLight;
+ static PoiCamera poiCam;
+ static PoiMesh poiMesh;
+ static UnityGI gi;
+ static FragmentCommonData s;
+ static PoiTangentData poiTData;
+ float4 finalColor;
+ float3 finalEmission;
+ float4 mainTexture;
+ float4 albedo;
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_Poicludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_Poicludes.cginc.meta
new file mode 100644
index 00000000..96bf58e2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/CGI_Poicludes.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a1ffb78a8d1d0534ead09d64e4ba14d1
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/Notes.txt b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/Notes.txt
new file mode 100644
index 00000000..32633192
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/Notes.txt
@@ -0,0 +1,7 @@
+// Transforms 2D UV by scale/bias property
+#define TRANSFORM_TEX(tex,name) (tex.xy * name##_ST.xy + name##_ST.zw)
+
+[HideInInspector][Vector2]Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] UV ("UV", Int) = 0
+
+:=--{reference_properties:[Pan, UV]} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/Notes.txt.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/Notes.txt.meta
new file mode 100644
index 00000000..e76b626e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Includes/Notes.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: e59bb8ae731c3d54fae2036a14f9ee8e
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon.meta
new file mode 100644
index 00000000..7afaebc9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: dc359ae4e892f2b4999c7d776fbd8c47
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/DepthGet.prefab b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/DepthGet.prefab
new file mode 100644
index 00000000..ce2bc66d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/DepthGet.prefab
@@ -0,0 +1,71 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &1259802800977766
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 4106851629791990}
+ - component: {fileID: 108814990146528582}
+ m_Layer: 0
+ m_Name: DepthGet
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &4106851629791990
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1259802800977766}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
+--- !u!108 &108814990146528582
+Light:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1259802800977766}
+ m_Enabled: 1
+ serializedVersion: 8
+ m_Type: 1
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_Intensity: 0.001
+ m_Range: 10
+ m_SpotAngle: 30
+ m_CookieSize: 10
+ m_Shadows:
+ m_Type: 1
+ m_Resolution: 0
+ m_CustomResolution: -1
+ m_Strength: 0
+ m_Bias: 0.05
+ m_NormalBias: 0.4
+ m_NearPlane: 0.2
+ m_Cookie: {fileID: 0}
+ m_DrawHalo: 0
+ m_Flare: {fileID: 0}
+ m_RenderMode: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4
+ m_Lightmapping: 4
+ m_LightShadowCasterMode: 0
+ m_AreaSize: {x: 1, y: 1}
+ m_BounceIntensity: 0
+ m_ColorTemperature: 6570
+ m_UseColorTemperature: 0
+ m_ShadowRadius: 0
+ m_ShadowAngle: 0
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/DepthGet.prefab.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/DepthGet.prefab.meta
new file mode 100644
index 00000000..d709ad58
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/DepthGet.prefab.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 23c61f8f4d0a87243a36c937bd3e1393
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX.meta
new file mode 100644
index 00000000..c8e4188c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bd3157fedeedfa54d951785bc8bf75e4
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX/PoiyomiEyeFX.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX/PoiyomiEyeFX.shader
new file mode 100644
index 00000000..d965068a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX/PoiyomiEyeFX.shader
@@ -0,0 +1,163 @@
+Shader ".poiyomi/Patreon/EyeFx"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor("", Float)=0
+ _MainTex ("Background", 2D) = "white" { }
+
+ _GradientFront ("Gradient Front", 2D) = "black" { }
+ _GradientBack ("Gradient Back", 2D) = "black" { }
+ _LineworkMask ("Linework Mask", 2D) = "black" { }
+ _HighlightMask ("Highlight Mask", 2D) = "black" { }
+ _FrontTexture ("Front Texture", 2D) = "white" { }
+ _BackTexture ("Back Texture", 2D) = "white" { }
+
+ _NoiseFront ("Noise Front Gradient", 2D) = "black" { }
+ _NoiseBack ("Noise Back Gradient", 2D) = "black" { }
+
+ _FrontTexturePan ("Front Texture Pan", Vector) = (0, 0, 0, 0)
+ _BackTexturePan ("Back Texture Pan", Vector) = (0, 0, 0, 0)
+ _NoiseFrontPanSpeed ("Noise Front Pan Speed", Vector) = (0, 0, 0, 0)
+ _NoiseBackPanSpeed ("Noise Back Pan Speed", Vector) = (0, 0, 0, 0)
+
+ [Space(20)]
+ _FrontGradientMod ("Front Grad Mod", Range(-1,1)) = 0
+ _BackGradientMod ("Back Grad Mod", Range(-1,1)) = 0
+ [Space(20)]
+ _GradientFrontColor ("Front Color", Color) = (1, 1, 1, 1)
+ _FrontEmission ("Front Emission", Float) = 0
+ _GradientBackColor ("Back Color", Color) = (1, 1, 1, 1)
+ _BackEmission ("Back Emission", Float) = 0
+ _Color ("BackgroundColor", Color) = (1, 1, 1, 1)
+ _BackgroundEmission ("Background Emission", Float) = 0
+ _LineworkColor ("Linework Color", Color) = (1, 1, 1, 1)
+ _LineworkEmission ("Linework Emission", Float) = 0
+ _HighlightColor ("Highlight Color", Color) = (1, 1, 1, 1)
+ _HighlightEmission ("Highlight Emission", Float) = 0
+ [Space(20)]
+
+ _BlendFront ("Front Soft-Hard", Range(0, 1)) = 1
+ _BlendBack ("Back Soft-Hard", Range(0, 1)) = 1
+
+ [Enum(Unlit, 0, Lit, 1)] _Lit ("Lighting", Int) = 0
+ }
+
+ SubShader
+ {
+ LOD 100
+ CGINCLUDE
+ #pragma target 5.0
+ ENDCG
+
+ Cull Back
+ ColorMask RGBA
+ ZWrite On
+ ZTest LEqual
+ Offset 0, 0
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+ CGPROGRAM
+
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma multi_compile_instancing
+ #include "UnityPBSLighting.cginc"
+ #include "UnityCG.cginc"
+
+
+ struct appdata
+ {
+ float4 vertex: POSITION;
+ float2 texcoord: TEXCOORD0;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ float2 uv: TEXCOORD0;
+
+ UNITY_VERTEX_OUTPUT_STEREO
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ sampler2D _MainTex; float4 _MainTex_ST;
+ sampler2D _GradientFront; float4 _GradientFront_ST;
+ sampler2D _GradientBack; float4 _GradientBack_ST;
+ sampler2D _LineworkMask; float4 _LineworkMask_ST;
+ sampler2D _HighlightMask; float4 _HighlightMask_ST;
+ sampler2D _NoiseFront; float4 _NoiseFront_ST;
+ sampler2D _NoiseBack; float4 _NoiseBack_ST;
+ sampler2D _FrontTexture; float4 _FrontTexture_ST;
+ sampler2D _BackTexture; float4 _BackTexture_ST;
+ float4 _FrontTexturePan;
+ float4 _BackTexturePan;
+ int _Lit;
+ // Colors
+ float4 _Color;
+ float4 _GradientFrontColor, _GradientBackColor, _LineworkColor, _HighlightColor;
+ float _BackgroundEmission, _FrontEmission, _BackEmission, _LineworkEmission, _HighlightEmission;
+ float _FrontGradientMod;
+ float _BackGradientMod;
+ // Blending
+ float _BlendBack, _BlendFront;
+ // Motion
+ float4 _NoiseFrontPanSpeed, _NoiseBackPanSpeed;
+
+ v2f vert(appdata v)
+ {
+ v2f o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+
+ o.pos = UnityObjectToClipPos(v.vertex);
+ o.uv = float4(v.texcoord.xy, 0, 0);
+ return o;
+ }
+
+ fixed4 frag(v2f i): SV_Target
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+ _FrontGradientMod = 1 - _FrontGradientMod;
+ _BackGradientMod = 1 - _BackGradientMod;
+ float4 background = tex2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex));
+ float gradientFront = tex2D(_GradientFront, TRANSFORM_TEX(i.uv, _GradientFront));
+ float gradientBack = tex2D(_GradientBack, TRANSFORM_TEX(i.uv, _GradientBack));
+ float lineworkMask = tex2D(_LineworkMask, TRANSFORM_TEX(i.uv, _LineworkMask));
+ float highlightMask = tex2D(_HighlightMask, TRANSFORM_TEX(i.uv, _HighlightMask));
+ float4 frontTexture = tex2D(_FrontTexture, TRANSFORM_TEX(i.uv, _FrontTexture) + _FrontTexturePan * _Time.y);
+ float4 backTexture = tex2D(_BackTexture, TRANSFORM_TEX(i.uv, _BackTexture) + _BackTexturePan * _Time.y);
+ float noiseFront = tex2D(_NoiseFront, TRANSFORM_TEX(i.uv, _NoiseFront) + _Time.y * _NoiseFrontPanSpeed);
+ float noiseBack = tex2D(_NoiseBack, TRANSFORM_TEX(i.uv, _NoiseBack) + _Time.y * _NoiseBackPanSpeed);
+
+ float frontAlpha = gradientFront - (gradientFront * lerp(lerp(_FrontGradientMod - noiseFront, 0, gradientFront), (1 - step(_FrontGradientMod - gradientFront, noiseFront)), _BlendFront));
+ float backAlpha = gradientBack - (gradientBack * lerp(lerp(_BackGradientMod - noiseBack, 0, gradientBack), (1 - step(_BackGradientMod - gradientBack, noiseBack)), _BlendBack));
+
+
+ // Ambient Lighting
+ float3 poiLighting = clamp(ShadeSH9(float4(0, 0, 0, 1)) + _LightColor0.rgb, 0, _LightColor0.a);
+
+ fixed4 finalColor = float4(background.rgb * _Color, 1);
+ finalColor = lerp(finalColor, _GradientBackColor * backTexture, backAlpha);
+ finalColor = lerp(finalColor, _GradientFrontColor * frontTexture, frontAlpha);
+ finalColor = lerp(finalColor, _LineworkColor, lineworkMask);
+ finalColor = lerp(finalColor, _HighlightColor, highlightMask);
+
+ finalColor.rgb *= lerp(1, poiLighting, _Lit);
+
+ fixed4 emissionColor = float4(background.rgb * _Color * _BackgroundEmission, 1);
+ emissionColor = lerp(emissionColor, _GradientBackColor * backTexture * _BackEmission, backAlpha);
+ emissionColor = lerp(emissionColor, _GradientFrontColor * frontTexture * _FrontEmission, frontAlpha);
+ emissionColor = lerp(emissionColor, _LineworkColor * _LineworkEmission, lineworkMask);
+ emissionColor = lerp(emissionColor, _HighlightColor * _HighlightEmission, highlightMask);
+
+ return finalColor + emissionColor;
+ }
+ ENDCG
+
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX/PoiyomiEyeFX.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX/PoiyomiEyeFX.shader.meta
new file mode 100644
index 00000000..fce28c28
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/EyeFX/PoiyomiEyeFX.shader.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 06e7a0cea07dc88429001d0cb84a92ca
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur.meta
new file mode 100644
index 00000000..336027d8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 43879ff41b138f94dab15b30bdf413b7
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro.meta
new file mode 100644
index 00000000..481d9874
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d0b9959fd582caf4c8560dd4eee7a835
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes.meta
new file mode 100644
index 00000000..a94bbfb0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c8d2c4a03a602244084a4912fef21844
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_FunctionsArtistic.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_FunctionsArtistic.cginc
new file mode 100644
index 00000000..8d98417c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_FunctionsArtistic.cginc
@@ -0,0 +1,369 @@
+#ifndef POI_FUNCTIONS_ARTISTIC
+ #define POI_FUNCTIONS_ARTISTIC
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ float3 hueShift(float3 color, float Offset)
+ {
+ float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
+ float4 P = lerp(float4(color.bg, K.wz), float4(color.gb, K.xy), step(color.b, color.g));
+ float4 Q = lerp(float4(P.xyw, color.r), float4(color.r, P.yzx), step(P.x, color.r));
+ float D = Q.x - min(Q.w, Q.y);
+ float E = 0.0000000001;
+ float3 hsv = float3(abs(Q.z + (Q.w - Q.y) / (6.0 * D + E)), D / (Q.x + E), Q.x);
+
+ float hue = hsv.x + Offset;
+ hsv.x = frac(hue);
+
+ float4 K2 = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ float3 P2 = abs(frac(hsv.xxx + K2.xyz) * 6.0 - K2.www);
+ return hsv.z * lerp(K2.xxx, saturate(P2 - K2.xxx), hsv.y);
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0): float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r): float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 HCYtoRGB(in float3 HCY)
+ {
+
+
+ float3 RGB = HUEtoRGB(HCY.x);
+ float Z = dot(RGB, HCYwts);
+ if (HCY.z < Z)
+ {
+ HCY.y *= HCY.z / Z;
+ }
+ else if(Z < 1)
+ {
+ HCY.y *= (1 - HCY.z) / (1 - Z);
+ }
+ return(RGB - Z) * HCY.y + HCY.z;
+ }
+
+ float3 RGBtoHCY(in float3 RGB)
+ {
+ // Corrected by David Schaeffer
+ float3 HCV = RGBtoHCV(RGB);
+ float Y = dot(RGB, HCYwts);
+ float Z = dot(HUEtoRGB(HCV.x), HCYwts);
+ if (Y < Z)
+ {
+ HCV.y *= Z / (Epsilon + Y);
+ }
+ else
+ {
+ HCV.y *= (1 - Z) / (Epsilon + 1 - Y);
+ }
+ return float3(HCV.x, HCV.y, Y);
+ }
+
+ float3 HCLtoRGB(in float3 HCL)
+ {
+ float3 RGB = 0;
+ if(HCL.z != 0)
+ {
+ float H = HCL.x;
+ float C = HCL.y;
+ float L = HCL.z * HCLmaxL;
+ float Q = exp((1 - C / (2 * L)) * (HCLgamma / HCLy0));
+ float U = (2 * L - C) / (2 * Q - 1);
+ float V = C / Q;
+ float A = (H + min(frac(2 * H) / 4, frac(-2 * H) / 8)) * pi * 2;
+ float T;
+ H *= 6;
+ if(H <= 0.999)
+ {
+ T = tan(A);
+ RGB.r = 1;
+ RGB.g = T / (1 + T);
+ }
+ else if(H <= 1.001)
+ {
+ RGB.r = 1;
+ RGB.g = 1;
+ }
+ else if(H <= 2)
+ {
+ T = tan(A);
+ RGB.r = (1 + T) / T;
+ RGB.g = 1;
+ }
+ else if(H <= 3)
+ {
+ T = tan(A);
+ RGB.g = 1;
+ RGB.b = 1 + T;
+ }
+ else if(H <= 3.999)
+ {
+ T = tan(A);
+ RGB.g = 1 / (1 + T);
+ RGB.b = 1;
+ }
+ else if(H <= 4.001)
+ {
+ RGB.g = 0;
+ RGB.b = 1;
+ }
+ else if(H <= 5)
+ {
+ T = tan(A);
+ RGB.r = -1 / T;
+ RGB.b = 1;
+ }
+ else
+ {
+ T = tan(A);
+ RGB.r = 1;
+ RGB.b = -T;
+ }
+ RGB = RGB * V + U;
+ }
+ return RGB;
+ }
+
+ float3 RGBtoHCL(in float3 RGB)
+ {
+ float3 HCL;
+ float H = 0;
+ float U = min(RGB.r, min(RGB.g, RGB.b));
+ float V = max(RGB.r, max(RGB.g, RGB.b));
+ float Q = HCLgamma / HCLy0;
+ HCL.y = V - U;
+ if(HCL.y != 0)
+ {
+ H = atan2(RGB.g - RGB.b, RGB.r - RGB.g) / pi;
+ Q *= U / V;
+ }
+ Q = exp(Q);
+ HCL.x = frac(H / 2 - min(frac(H), frac(-H)) / 6);
+ HCL.y *= Q;
+ HCL.z = lerp(-U, V, Q) / (HCLmaxL * 2);
+ return HCL;
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + pi * 3., TAU) - pi;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_FunctionsArtistic.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_FunctionsArtistic.cginc.meta
new file mode 100644
index 00000000..09b57d92
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_FunctionsArtistic.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ba417e0420957024aaaf33fbb6fedf2b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAlphaToCoverage.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAlphaToCoverage.cginc
new file mode 100644
index 00000000..3abae393
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAlphaToCoverage.cginc
@@ -0,0 +1,32 @@
+#ifndef POI_ALPHA_TO_COVERAGE
+ #define POI_ALPHA_TO_COVERAGE
+
+ half _MainMipScale;
+ float _MainAlphaToCoverage;
+
+ 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);
+ }
+
+ void ApplyAlphaToCoverage(inout float4 finalColor)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if(_MainAlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ finalColor.a *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _MainMipScale;
+ // rescale alpha by partial derivative
+ finalColor.a = (finalColor.a - _Cutoff) / max(fwidth(finalColor.a), 0.0001) + _Cutoff;
+ }
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAlphaToCoverage.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAlphaToCoverage.cginc.meta
new file mode 100644
index 00000000..ad833f2e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAlphaToCoverage.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f8fa069a738a81142bbd2819da671b45
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAudioLink.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAudioLink.cginc
new file mode 100644
index 00000000..ed847502
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAudioLink.cginc
@@ -0,0 +1,128 @@
+#ifndef POI_AUDIOLINK
+#define POI_AUDIOLINK
+
+UNITY_DECLARE_TEX2D(_AudioTexture);
+float4 _AudioTexture_ST;
+fixed _AudioLinkDelay;
+fixed _AudioLinkAveraging;
+fixed _AudioLinkAverageRange;
+
+// Debug
+fixed _EnableAudioLinkDebug;
+fixed _AudioLinkDebugTreble;
+fixed _AudioLinkDebugHighMid;
+fixed _AudioLinkDebugLowMid;
+fixed _AudioLinkDebugBass;
+fixed _AudioLinkDebugAnimate;
+fixed _AudioLinkTextureVisualization;
+fixed _AudioLinkAnimToggle;
+
+void AudioTextureExists()
+{
+ half testw = 0;
+ half testh = 0;
+ _AudioTexture.GetDimensions(testw, testh);
+ poiMods.audioLinkTextureExists = testw >= 32;
+ poiMods.audioLinkTextureExists *= _AudioLinkAnimToggle;
+ switch(testw)
+ {
+ case 32: // V1
+ poiMods.audioLinkVersion = 1;
+ break;
+ case 128: // V2
+ poiMods.audioLinkVersion = 2;
+ break;
+ default:
+ poiMods.audioLinkVersion = 1;
+ break;
+ }
+}
+
+float getBandAtTime(float band, fixed time, fixed width)
+{
+ float versionUvMultiplier = 1;
+
+ if (poiMods.audioLinkVersion == 2)
+ {
+ versionUvMultiplier = 0.0625;
+ }
+ return UNITY_SAMPLE_TEX2D(_AudioTexture, float2(time * width, (band * .25 + .125) * versionUvMultiplier)).r;
+}
+
+void initAudioBands()
+{
+ AudioTextureExists();
+
+ float versionUvMultiplier = 1;
+
+ if (poiMods.audioLinkVersion == 2)
+ {
+ versionUvMultiplier = 0.0625;
+ }
+
+ if (poiMods.audioLinkTextureExists)
+ {
+ poiMods.audioLink.x = UNITY_SAMPLE_TEX2D(_AudioTexture, float2(_AudioLinkDelay, .125 * versionUvMultiplier));
+ poiMods.audioLink.y = UNITY_SAMPLE_TEX2D(_AudioTexture, float2(_AudioLinkDelay, .375 * versionUvMultiplier));
+ poiMods.audioLink.z = UNITY_SAMPLE_TEX2D(_AudioTexture, float2(_AudioLinkDelay, .625 * versionUvMultiplier));
+ poiMods.audioLink.w = UNITY_SAMPLE_TEX2D(_AudioTexture, float2(_AudioLinkDelay, .875 * versionUvMultiplier));
+
+ UNITY_BRANCH
+ if (_AudioLinkAveraging)
+ {
+ float uv = saturate(_AudioLinkDelay + _AudioLinkAverageRange * .25);
+ poiMods.audioLink.x += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .125 * versionUvMultiplier));
+ poiMods.audioLink.y += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .375 * versionUvMultiplier));
+ poiMods.audioLink.z += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .625 * versionUvMultiplier));
+ poiMods.audioLink.w += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .875 * versionUvMultiplier));
+
+ uv = saturate(_AudioLinkDelay + _AudioLinkAverageRange * .5);
+ poiMods.audioLink.x += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .125 * versionUvMultiplier));
+ poiMods.audioLink.y += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .375 * versionUvMultiplier));
+ poiMods.audioLink.z += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .625 * versionUvMultiplier));
+ poiMods.audioLink.w += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .875 * versionUvMultiplier));
+
+ uv = saturate(_AudioLinkDelay + _AudioLinkAverageRange * .75);
+ poiMods.audioLink.x += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .125 * versionUvMultiplier));
+ poiMods.audioLink.y += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .375 * versionUvMultiplier));
+ poiMods.audioLink.z += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .625 * versionUvMultiplier));
+ poiMods.audioLink.w += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .875 * versionUvMultiplier));
+
+ uv = saturate(_AudioLinkDelay + _AudioLinkAverageRange);
+ poiMods.audioLink.x += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .125 * versionUvMultiplier));
+ poiMods.audioLink.y += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .375 * versionUvMultiplier));
+ poiMods.audioLink.z += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .625 * versionUvMultiplier));
+ poiMods.audioLink.w += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .875 * versionUvMultiplier));
+
+ poiMods.audioLink /= 5;
+ }
+ }
+
+ #ifndef OPTIMIZER_ENABLED
+ UNITY_BRANCH
+ if (_EnableAudioLinkDebug)
+ {
+ poiMods.audioLink.x = _AudioLinkDebugBass;
+ poiMods.audioLink.y = _AudioLinkDebugLowMid;
+ poiMods.audioLink.z = _AudioLinkDebugHighMid;
+ poiMods.audioLink.w = _AudioLinkDebugTreble;
+
+ if (_AudioLinkDebugAnimate)
+ {
+ poiMods.audioLink.x *= (sin(_Time.w * 3.1) + 1) * .5;
+ poiMods.audioLink.y *= (sin(_Time.w * 3.2) + 1) * .5;
+ poiMods.audioLink.z *= (sin(_Time.w * 3.3) + 1) * .5;
+ poiMods.audioLink.w *= (sin(_Time.w * 3) + 1) * .5;
+ }
+ poiMods.audioLinkTextureExists = 1;
+ }
+
+ UNITY_BRANCH
+ if (_AudioLinkTextureVisualization)
+ {
+ poiMods.audioLinkTexture = UNITY_SAMPLE_TEX2D(_AudioTexture, poiMesh.uv[0]);
+ }
+ #endif
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAudioLink.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAudioLink.cginc.meta
new file mode 100644
index 00000000..a63cf6e2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiAudioLink.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 64b7800f1104cd747a5d450f0578176f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBRDF.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBRDF.cginc
new file mode 100644
index 00000000..d639a2db
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBRDF.cginc
@@ -0,0 +1,253 @@
+#ifndef POI_BRDF
+ #define POI_BRDF
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2020 Xiexe
+ *
+ * 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
+ * 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.
+ */
+
+ #if defined(PROP_BRDFMETALLICGLOSSMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_BRDFMetallicGlossMap);
+ #endif
+ #if defined(PROP_BRDFSPECULARMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_BRDFSpecularMap);
+ #endif
+ #if defined(PROP_BRDFMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_BRDFMetallicMap);
+ #endif
+
+ samplerCUBE _BRDFFallback;
+
+ float _BRDFMetallic;
+ float _BRDFGlossiness;
+ float _BRDFReflectance;
+ float _BRDFAnisotropy;
+ float _BRDFReflectionsEnabled;
+ float _BRDFSpecularEnabled;
+ float _BRDFInvertGlossiness;
+ float _BRDFForceFallback;
+
+ bool DoesReflectionProbeExist()
+ {
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiCam.reflectionDir, UNITY_SPECCUBE_LOD_STEPS);
+ bool probeExists = !(unity_SpecCube0_HDR.a == 0 && envSample.a == 0);
+ return probeExists && !_BRDFForceFallback;
+ }
+
+ float getGeometricSpecularAA(float3 normal)
+ {
+ float3 vNormalWsDdx = ddx(normal.xyz);
+ float3 vNormalWsDdy = ddy(normal.xyz);
+ float flGeometricRoughnessFactor = pow(saturate(max(dot(vNormalWsDdx.xyz, vNormalWsDdx.xyz), dot(vNormalWsDdy.xyz, vNormalWsDdy.xyz))), 0.333);
+ return max(0, flGeometricRoughnessFactor);
+ }
+
+ float3 getAnisotropicReflectionVector(float3 viewDir, float3 bitangent, float3 tangent, float3 normal, float roughness, float anisotropy)
+ {
+ float3 anisotropicDirection = anisotropy >= 0.0 ? bitangent: tangent;
+ float3 anisotropicTangent = cross(anisotropicDirection, viewDir);
+ float3 anisotropicNormal = cross(anisotropicTangent, anisotropicDirection);
+ float bendFactor = abs(anisotropy) * saturate(5.0 * roughness);
+ float3 bentNormal = normalize(lerp(normal, anisotropicNormal, bendFactor));
+ return reflect(-viewDir, bentNormal);
+ }
+
+ float3 F_Schlick(float u, float3 f0)
+ {
+ return f0 + (1.0 - f0) * pow(1.0 - u, 5.0);
+ }
+
+ float3 F_Schlick(const float3 f0, float f90, float VoH)
+ {
+ // Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering"
+ float pow5 = 1.0 - VoH;
+ pow5 = pow5 * pow5 * pow5 * pow5 * pow5;
+ return f0 + (f90 - f0) * pow5;
+ }
+
+ float D_GGX(float NoH, float roughness)
+ {
+ float a2 = roughness * roughness;
+ float f = (NoH * a2 - NoH) * NoH + 1.0;
+ return a2 / (UNITY_PI * f * f);
+ }
+
+ float V_SmithGGXCorrelated(float NoV, float NoL, float a)
+ {
+ float a2 = a * a;
+ float GGXL = NoV * sqrt((-NoL * a2 + NoL) * NoL + a2);
+ float GGXV = NoL * sqrt((-NoV * a2 + NoV) * NoV + a2);
+ return 0.5 / (GGXV + GGXL);
+ }
+
+ float D_GGX_Anisotropic(float NoH, const float3 h, const float3 t, const float3 b, float at, float ab)
+ {
+ float ToH = dot(t, h);
+ float BoH = dot(b, h);
+ float a2 = at * ab;
+ float3 v = float3(ab * ToH, at * BoH, a2 * NoH);
+ float v2 = dot(v, v);
+ float w2 = a2 / v2;
+ return a2 * w2 * w2 * (1.0 / UNITY_PI);
+ }
+
+ float3 getBoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax)
+ {
+ // #if defined(UNITY_SPECCUBE_BOX_PROJECTION) // For some reason this doesn't work?
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax: boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ // #endif
+ return direction;
+ }
+
+ float3 getDirectSpecular(float roughness, float ndh, float vdn, float ndl, float ldh, float3 f0, float3 halfVector, float3 tangent, float3 bitangent, float anisotropy)
+ {
+ #if !defined(LIGHTMAP_ON)
+ float rough = max(roughness * roughness, 0.0045);
+ float Dn = D_GGX(ndh, rough);
+ float3 F = F_Schlick(ldh, f0);
+ float V = V_SmithGGXCorrelated(vdn, ndl, rough);
+ float3 directSpecularNonAniso = max(0, (Dn * V) * F);
+
+ anisotropy *= saturate(5.0 * roughness);
+ float at = max(rough * (1.0 + anisotropy), 0.001);
+ float ab = max(rough * (1.0 - anisotropy), 0.001);
+ float D = D_GGX_Anisotropic(ndh, halfVector, tangent, bitangent, at, ab);
+ float3 directSpecularAniso = max(0, (D * V) * F);
+
+ return lerp(directSpecularNonAniso, directSpecularAniso, saturate(abs(_BRDFAnisotropy * 100))) * 3; // * 100 to prevent blending, blend because otherwise tangents are fucked on lightmapped object
+ #else
+ return 0;
+ #endif
+ }
+
+ float3 getIndirectSpecular(float metallic, float roughness, float3 reflDir, float3 worldPos, float3 lightmap, float3 normal)
+ {
+ float3 spec = float3(0, 0, 0);
+ #if defined(UNITY_PASS_FORWARDBASE)
+ float3 indirectSpecular;
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = roughness;
+ envData.reflUVW = getBoxProjection(
+ reflDir, 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);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ envData.reflUVW = getBoxProjection(
+ reflDir, worldPos,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz
+ );
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube0_HDR, envData);
+ indirectSpecular = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ indirectSpecular = probe0;
+ }
+
+ if(!DoesReflectionProbeExist())
+ {
+ indirectSpecular = texCUBElod(_BRDFFallback, float4(reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS)).rgb * poiLight.finalLighting;
+ }
+
+ float horizon = min(1 + dot(reflDir, normal), 1);
+ indirectSpecular *= horizon * horizon;
+
+ spec = indirectSpecular;
+ #if defined(LIGHTMAP_ON)
+ float specMultiplier = max(0, lerp(1, pow(length(lightmap), _SpecLMOcclusionAdjust), _SpecularLMOcclusion));
+ spec *= specMultiplier;
+ #endif
+ #endif
+ return spec;
+ }
+
+ void poiBRDF(inout float4 finalColor, const float4 finalColorBeforeLighting)
+ {
+ float4 ret = float4(1, 0, 0, 1);
+ #if defined(PROP_BRDFMETALLICGLOSSMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 metallicGlossMap = POI2D_SAMPLER_PAN(_BRDFMetallicGlossMap, _MainTex, poiMesh.uv[_BRDFMetallicGlossMapUV], _BRDFMetallicGlossMapPan);
+ #else
+ float4 metallicGlossMap = 1;
+ #endif
+ #if defined(PROP_BRDFSPECULARMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 spcularTintMask = POI2D_SAMPLER_PAN(_BRDFSpecularMap, _MainTex, poiMesh.uv[_BRDFSpecularMapUV], _BRDFSpecularMapPan);
+ #else
+ float4 spcularTintMask = 1;
+ #endif
+ #if defined(PROP_BRDFMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 metallicTintMask = POI2D_SAMPLER_PAN(_BRDFMetallicMap, _MainTex, poiMesh.uv[_BRDFMetallicMapUV], _BRDFMetallicMapPan);
+ #else
+ float4 metallicTintMask = 1;
+ #endif
+ UNITY_BRANCH
+ if(_BRDFInvertGlossiness == 1)
+ {
+ metallicGlossMap.a = 1 - metallicGlossMap.a;
+ }
+
+ float metallic = metallicGlossMap.r * _BRDFMetallic;
+ float reflectance = metallicGlossMap.g * _BRDFReflectance;
+ float roughness = max(1 - (_BRDFGlossiness * metallicGlossMap.a), getGeometricSpecularAA(poiMesh.normals[1]));
+ finalColor.rgb *= lerp(1, 1 - metallic, _BRDFReflectionsEnabled);
+
+ float3 reflViewDir = getAnisotropicReflectionVector(poiCam.viewDir, poiMesh.binormal, poiMesh.tangent.xyz, poiMesh.normals[1], roughness, _BRDFAnisotropy);
+ float3 reflLightDir = reflect(poiLight.direction, poiMesh.normals[1]);
+
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ float attenuation = poiMax(poiLight.rampedLightMap);
+ #endif
+ #ifdef FORWARD_ADD_PASS
+ float attenuation = saturate(poiLight.nDotL);
+ #endif
+
+
+ float3 f0 = 0.16 * reflectance * reflectance * (1.0 - metallic) + finalColorBeforeLighting.rgb * metallic;
+ float3 fresnel = lerp(F_Schlick(poiLight.nDotV, f0), f0, metallic); //Kill fresnel on metallics, it looks bad.
+ float3 directSpecular = getDirectSpecular(roughness, saturate(poiLight.nDotH), max(poiLight.nDotV, 0.000001), attenuation, saturate(poiLight.lDotH), f0, poiLight.halfDir, poiMesh.tangent.xyz, poiMesh.binormal, _BRDFAnisotropy) * poiLight.attenuation * attenuation * poiLight.color;
+ directSpecular = min(directSpecular, poiLight.color);
+
+ float3 vDirectSpecular = 0;
+ #ifdef VERTEXLIGHT_ON
+ for (int index = 0; index < 4; index ++)
+ {
+ float3 v0directSpecular = getDirectSpecular(roughness, saturate(poiLight.vDotNH[index]), max(poiLight.nDotV, 0.000001), attenuation, saturate(poiLight.lDotH), f0, poiLight.vHalfDir[index], poiMesh.tangent, poiMesh.binormal, _BRDFAnisotropy) * poiLight.attenuation * poiLight.vAttenuationDotNL[index] * poiLight.vColor[index];
+ vDirectSpecular += min(v0directSpecular, poiLight.vColor[index]);
+ }
+ #endif
+
+ float3 indirectSpecular = getIndirectSpecular(metallic, roughness, reflViewDir, poiMesh.worldPos, /*directDiffuse*/ finalColor.rgb, poiMesh.normals[1]) * lerp(fresnel, f0, roughness);
+ float3 specular = indirectSpecular * _BRDFReflectionsEnabled * metallicTintMask.a * metallicTintMask.rgb * poiLight.occlusion + (directSpecular + vDirectSpecular) * _BRDFSpecularEnabled * spcularTintMask.a * spcularTintMask.rgb;
+ finalColor.rgb += specular;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBRDF.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBRDF.cginc.meta
new file mode 100644
index 00000000..f4ab1fe6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBRDF.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: efdd412bc3e3a9d4d80dd15e24adddce
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBackFace.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBackFace.cginc
new file mode 100644
index 00000000..57294263
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBackFace.cginc
@@ -0,0 +1,49 @@
+#ifndef POI_BACKFACE
+#define POI_BACKFACE
+
+float _BackFaceEnabled;
+float _BackFaceTextureUV;
+float _BackFaceDetailIntensity;
+float _BackFaceEmissionStrength;
+float2 _BackFacePanning;
+float _BackFaceHueShift;
+float4 _BackFaceColor;
+float _BackFaceReplaceAlpha;
+
+#if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_BackFaceTexture); float4 _BackFaceTexture_ST;
+#endif
+
+float3 BackFaceColor;
+void applyBackFaceTexture(inout float backFaceDetailIntensity, inout float mixedHueShift, inout float4 albedo, inout float3 backFaceEmission)
+{
+ backFaceEmission = 0;
+ BackFaceColor = 0;
+ UNITY_BRANCH
+ if (_BackFaceEnabled)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ #if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 backFaceTex = POI2D_SAMPLER_PAN(_BackFaceTexture, _MainTex, poiMesh.uv[_BackFaceTextureUV], _BackFacePanning) * _BackFaceColor;
+ #else
+ float4 backFaceTex = _BackFaceColor;
+ #endif
+
+ albedo.rgb = backFaceTex.rgb;
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ albedo.a = backFaceTex.a;
+ }
+
+ backFaceDetailIntensity = _BackFaceDetailIntensity;
+ BackFaceColor = albedo.rgb;
+ mixedHueShift = _BackFaceHueShift;
+ backFaceEmission = BackFaceColor * _BackFaceEmissionStrength;
+ }
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBackFace.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBackFace.cginc.meta
new file mode 100644
index 00000000..998df184
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBackFace.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 37fd65337c99b524b884507d97cef692
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlackLight.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlackLight.cginc
new file mode 100644
index 00000000..0ae60087
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlackLight.cginc
@@ -0,0 +1,56 @@
+#ifndef POI_BLACKLIGHT
+ #define POI_BLACKLIGHT
+
+ float4 _BlackLightMaskStart;
+ float4 _BlackLightMaskEnd;
+ float4 _BlackLightMaskKeys;
+ float _BlackLightMaskDebug;
+ float _BlackLightMaskDissolve;
+ float _BlackLightAdjustDissolve;
+ float _BlackLightMaskMetallic;
+ float _BlackLightMaskClearCoat;
+ float _BlackLightMaskMatcap;
+ float _BlackLightMaskMatcap2;
+ float _BlackLightMaskEmission;
+ float _BlackLightMaskEmission2;
+ float _BlackLightMaskFlipbook;
+ float _BlackLightMaskPanosphere;
+ float _BlackLightMaskIridescence;
+ float _BlackLightMove;
+
+ half _BlackLightMaskGlitter;
+
+ half4 blackLightMask;
+
+ void createBlackLightMask()
+ {
+ blackLightMask = 0;
+ #ifdef VERTEXLIGHT_ON
+
+ for (int lightIndex = 0; lightIndex < 4; lightIndex ++)
+ {
+ float3 lightPos = float3(unity_4LightPosX0[lightIndex], unity_4LightPosY0[lightIndex], unity_4LightPosZ0[lightIndex]);
+ if (!distance(unity_LightColor[lightIndex].rgb, float3(0, 0, 0)))
+ {
+ for (int maskIndex = 0; maskIndex < 4; maskIndex ++)
+ {
+ float4 comparison = _BlackLightMaskKeys;
+ if(unity_LightColor[lightIndex].a == comparison[maskIndex])
+ {
+ blackLightMask[maskIndex] = max(blackLightMask[maskIndex], smoothstep(_BlackLightMaskEnd[maskIndex], _BlackLightMaskStart[maskIndex], distance(poiMesh.worldPos, lightPos)));
+ }
+ }
+ }
+ }
+ #endif
+ }
+#endif
+
+/*
+#ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ blackLightMask[mask];
+ }
+#endif
+*/ \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlackLight.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlackLight.cginc.meta
new file mode 100644
index 00000000..9922c825
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlackLight.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6f631ea0131ab2a49bd7707448f4e7d5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlending.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlending.cginc
new file mode 100644
index 00000000..1016ae12
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlending.cginc
@@ -0,0 +1,385 @@
+#ifndef POI_BLENDING
+ #define POI_BLENDING
+
+ /*
+ 0: Zero float4(0.0, 0.0, 0.0, 0.0),
+ 1: One float4(1.0, 1.0, 1.0, 1.0),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return(base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return(blend == 0.0)?blend: max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlending.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlending.cginc.meta
new file mode 100644
index 00000000..5719e687
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBlending.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 25a28d5d472d1434d95a1da18f826ff9
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBulge.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBulge.cginc
new file mode 100644
index 00000000..09e44d6f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBulge.cginc
@@ -0,0 +1,41 @@
+#ifndef POI_BULGE
+ #define POI_BULGE
+
+ float _BuldgeFadeLength;
+ float _BuldgeHeight;
+
+ #if defined(PROP_BULGEMASK) || !defined(OPTIMIZER_ENABLED)
+ sampler2D _BulgeMask;
+ #endif
+
+ void bulgyWolgy(inout v2f o)
+ {
+ float depth = DecodeFloatRG(tex2Dlod(_CameraDepthTexture, float4(o.grabPos.xy / o.grabPos.w, 0, 0)));
+ #if defined(PROP_BULGEMASK) || !defined(OPTIMIZER_ENABLED)
+ float bulgeMask = tex2Dlod(_BulgeMask, float4(o.uv0.xy, 0, 0));
+ #else
+ float bulgeMask = 1.0;
+ #endif
+
+ depth = Linear01Depth(depth);
+
+ float intersect = 0;
+ if (depth != 1)
+ {
+ float diff = distance(depth, Linear01Depth(o.pos.z / o.pos.w));
+ if(diff > 0)
+ {
+ intersect = 1 - smoothstep(0, _ProjectionParams.w * _BuldgeFadeLength, diff);
+ }
+ }
+ float4 offset = intersect * _BuldgeHeight * float4(o.normal, 0);
+
+ offset = IsInMirror() ? 0: offset;
+ offset *= bulgeMask;
+
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos) + offset;
+ o.localPos = mul(unity_WorldToObject, o.worldPos);
+ o.pos = UnityObjectToClipPos(o.localPos);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBulge.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBulge.cginc.meta
new file mode 100644
index 00000000..019bc0da
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiBulge.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0c67db18820cd0b4a9a8c6fab9b587cf
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiClearCoat.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiClearCoat.cginc
new file mode 100644
index 00000000..77f4954d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiClearCoat.cginc
@@ -0,0 +1,327 @@
+#ifndef POI_CLEARCOAT
+#define POI_CLEARCOAT
+
+float _Clearcoat;
+float _ClearcoatGlossiness;
+float _ClearcoatAnisotropy;
+float _ClearcoatForceFallback;
+float _ClearcoatEnableReflections;
+float _ClearcoatEnableSpecular;
+float _ClearcoatInvertSmoothness;
+#if defined(PROP_CLEARCOATMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_ClearcoatMap);
+#endif
+
+samplerCUBE _ClearcoatFallback;
+/*
+samplerCUBE _ClearCoatCubeMap;
+float _ClearCoatSampleWorld;
+float _ClearcoatInvertSmoothness;
+float _Clearcoat;
+float3 _ClearCoatTint;
+float _ClearCoatNormalToUse;
+float _ClearCoatForceLighting;
+float lighty_clear_boy_uwu_var;
+
+#if defined(PROP_CLEARCOATSMOOTHNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_ClearCoatSmoothnessMap);
+#endif
+
+float3 CalculateClearCoatEnvironmentalReflections()
+{
+ float3 reflectionColor;
+
+ #if defined(PROP_CLEARCOATSMOOTHNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_ClearCoatSmoothnessMap, _MainTex, poiMesh.uv[_ClearCoatSmoothnessMapUV], _ClearCoatSmoothnessMapPan));
+ #else
+ float smoothnessMap = 1.0;
+ #endif
+
+ if (_ClearcoatInvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _ClearCoatSmoothness;
+ float roughness = 1 - smoothnessMap;
+
+ lighty_clear_boy_uwu_var = 0;
+
+ float3 reflectedDir = _ClearCoatNormalToUse == 0 ? poiCam.vertexReflectionDir: poiCam.reflectionDir;
+
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ bool no_probe = unity_SpecCube0_HDR.a == 0 && envSample.a == 0;
+
+ UNITY_BRANCH
+ if(_ClearCoatSampleWorld == 0 && no_probe == 0)
+ {
+
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = roughness;
+ envData.reflUVW = BoxProjection(
+ reflectedDir, poiMesh.worldPos.xyz,
+ unity_SpecCube0_ProbePosition,
+ unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax
+ );
+ float3 probe0 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData
+ );
+ envData.reflUVW = BoxProjection(
+ reflectedDir, poiMesh.worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax
+ );
+
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ float3 probe1 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0),
+ unity_SpecCube0_HDR, envData
+ );
+ reflectionColor = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ reflectionColor = probe0;
+ }
+ }
+ else
+ {
+ lighty_clear_boy_uwu_var = 1;
+ reflectionColor = texCUBElod(_ClearCoatCubeMap, float4(reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ }
+
+ if(_ClearCoatForceLighting)
+ {
+ lighty_clear_boy_uwu_var = 1;
+ }
+
+ return reflectionColor * _ClearCoatTint;
+}
+
+void calculateAndApplyClearCoat(inout float4 finalColor)
+{
+ #if defined(PROP_CLEARCOATMASK) || !defined(OPTIMIZER_ENABLED)
+ half clearCoatMap = POI2D_SAMPLER_PAN(_ClearcoatMap, _MainTex, poiMesh.uv[_ClearCoatMaskUV], _ClearCoatMaskPan);
+ #else
+ half clearCoatMap = 1;
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskClearCoat != 4)
+ {
+ clearCoatMap *= blackLightMask[_BlackLightMaskClearCoat];
+ }
+ #endif
+
+ half3 reflectionColor = CalculateClearCoatEnvironmentalReflections();
+
+ float NormalDotView = abs(dot(_Clearcoat, _ClearCoatNormalToUse == 0 ? poiLight.N0DotV: poiLight.nDotV).r);
+ #ifdef POI_LIGHTING
+ finalColor.rgb = lerp(finalColor.rgb, reflectionColor * lerp(1, poiLight.finalLighting, lighty_clear_boy_uwu_var), clearCoatMap * _Clearcoat * clamp(FresnelTerm(_Clearcoat, NormalDotView), 0, 1));
+ //finalColor.rgb += reflectionColor;
+ //finalColor.rgb = finalColor.rgb * (1- (reflectionColor.r + reflectionColor.g + reflectionColor.b)/3) + reflectionColor * clearCoatMap * lerp(1, poiLight.finalLighting, lighty_clear_boy_uwu_var);
+ #else
+ finalColor.rgb = lerp(finalColor.rgb, reflectionColor, clearCoatMap * _Clearcoat * clamp(FresnelTerm(_Clearcoat, NormalDotView), 0, 1));
+ #endif
+}
+*/
+
+bool clearcoatDoesReflectionProbeExist()
+{
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiCam.reflectionDir, UNITY_SPECCUBE_LOD_STEPS);
+ bool probeExists = !(unity_SpecCube0_HDR.a == 0 && envSample.a == 0);
+ return probeExists && !_ClearcoatForceFallback;
+}
+
+float3 clearcoatF_Schlick(float u, float3 f0)
+{
+ return f0 + (1.0 - f0) * pow(1.0 - u, 5.0);
+}
+
+float4 getClearcoatSmoothness(float4 clearcoatMap)
+{
+ float roughness = 1 - (_ClearcoatGlossiness * clearcoatMap.a);
+ roughness = clamp(roughness, 0.0045, 1.0);
+ roughness = roughness * roughness;
+
+ float reflectivity = _Clearcoat * clearcoatMap.r;
+ return float4(reflectivity, 0, 0, roughness);
+}
+
+float getGeometricClearCoatSpecularAA(float3 normal)
+{
+ float3 vNormalWsDdx = ddx(normal.xyz);
+ float3 vNormalWsDdy = ddy(normal.xyz);
+ float flGeometricRoughnessFactor = pow(saturate(max(dot(vNormalWsDdx.xyz, vNormalWsDdx.xyz), dot(vNormalWsDdy.xyz, vNormalWsDdy.xyz))), 0.333);
+ return max(0, flGeometricRoughnessFactor);
+}
+
+float3 getClearcoatAnisotropicReflectionVector(float3 viewDir, float3 bitangent, float3 tangent, float3 normal, float roughness, float anisotropy)
+{
+ //_Anisotropy = lerp(-0.2, 0.2, sin(_Time.y / 20)); //This is pretty fun
+ float3 anisotropicDirection = anisotropy >= 0.0 ? bitangent: tangent;
+ float3 anisotropicTangent = cross(anisotropicDirection, viewDir);
+ float3 anisotropicNormal = cross(anisotropicTangent, anisotropicDirection);
+ float bendFactor = abs(anisotropy) * saturate(5.0 * roughness);
+ float3 bentNormal = normalize(lerp(normal, anisotropicNormal, bendFactor));
+ return reflect(-viewDir, bentNormal);
+}
+
+float D_GGXClearcoat(float NoH, float roughness)
+{
+ float a2 = roughness * roughness;
+ float f = (NoH * a2 - NoH) * NoH + 1.0;
+ return a2 / (UNITY_PI * f * f);
+}
+
+float D_GGXClearcoat_Anisotropic(float NoH, const float3 h, const float3 t, const float3 b, float at, float ab)
+{
+ float ToH = dot(t, h);
+ float BoH = dot(b, h);
+ float a2 = at * ab;
+ float3 v = float3(ab * ToH, at * BoH, a2 * NoH);
+ float v2 = dot(v, v);
+ float w2 = a2 / v2;
+ return a2 * w2 * w2 * (1.0 / UNITY_PI);
+}
+
+float V_SmithGGXClearcoatCorrelated(float NoV, float NoL, float a)
+{
+ float a2 = a * a;
+ float GGXL = NoV * sqrt((-NoL * a2 + NoL) * NoL + a2);
+ float GGXV = NoL * sqrt((-NoV * a2 + NoV) * NoV + a2);
+ return 0.5 / (GGXV + GGXL);
+}
+
+float3 getClearcoatDirectSpecular(float roughness, float ndh, float vdn, float ndl, float ldh, float3 f0, float3 halfVector, float3 tangent, float3 bitangent, float anisotropy)
+{
+ #if !defined(LIGHTMAP_ON)
+ float rough = max(roughness * roughness, 0.0045);
+ float Dn = D_GGXClearcoat(ndh, rough);
+ float3 F = clearcoatF_Schlick(ldh, f0);
+ float V = V_SmithGGXClearcoatCorrelated(vdn, ndl, rough);
+ float3 directSpecularNonAniso = max(0, (Dn * V) * F);
+
+ anisotropy *= saturate(5.0 * roughness);
+ float at = max(rough * (1.0 + anisotropy), 0.001);
+ float ab = max(rough * (1.0 - anisotropy), 0.001);
+ float D = D_GGXClearcoat_Anisotropic(ndh, halfVector, tangent, bitangent, at, ab);
+ float3 directSpecularAniso = max(0, (D * V) * F);
+
+ return lerp(directSpecularNonAniso, directSpecularAniso, saturate(abs(_ClearcoatAnisotropy * 100))) * 3; // * 100 to prevent blending, blend because otherwise tangents are fucked on lightmapped object
+ #else
+ return 0;
+ #endif
+}
+
+float3 getClearCoatBoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax)
+{
+ // #if defined(UNITY_SPECCUBE_BOX_PROJECTION) // For some reason this doesn't work?
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax: boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ // #endif
+ return direction;
+}
+
+float3 getClearcoatIndirectSpecular(float metallic, float roughness, float3 reflDir, float3 worldPos, float3 lightmap, float3 normal)
+{
+ float3 spec = float3(0, 0, 0);
+ #if defined(UNITY_PASS_FORWARDBASE)
+ float3 indirectSpecular;
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = roughness;
+ envData.reflUVW = getClearCoatBoxProjection(
+ reflDir, 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);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ envData.reflUVW = getClearCoatBoxProjection(
+ reflDir, worldPos,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz
+ );
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube0_HDR, envData);
+ indirectSpecular = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ indirectSpecular = probe0;
+ }
+
+ if (!clearcoatDoesReflectionProbeExist())
+ {
+ indirectSpecular = texCUBElod(_ClearcoatFallback, float4(envData.reflUVW, roughness * UNITY_SPECCUBE_LOD_STEPS)).rgb * poiLight.finalLighting;
+ }
+
+ float horizon = min(1 + dot(reflDir, normal), 1);
+ indirectSpecular *= horizon * horizon;
+
+ spec = indirectSpecular;
+ #if defined(LIGHTMAP_ON)
+ float specMultiplier = max(0, lerp(1, pow(length(lightmap), _SpecLMOcclusionAdjust), _SpecularLMOcclusion));
+ spec *= specMultiplier;
+ #endif
+ #endif
+ return spec;
+}
+
+void calculateAndApplyClearCoat(inout float4 finalColor)
+{
+ #if defined(PROP_CLEARCOATMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clearCoatMap = POI2D_SAMPLER_PAN(_ClearcoatMap, _MainTex, poiMesh.uv[_ClearcoatMapUV], _ClearcoatMapPan);
+ #else
+ float4 clearCoatMap = 1;
+ #endif
+
+ float4 clearcoatReflectivitySmoothness = getClearcoatSmoothness(clearCoatMap);
+ float clearcoatReflectivity = clearcoatReflectivitySmoothness.r;
+ float clearcoatRoughness = clearcoatReflectivitySmoothness.a;
+ UNITY_BRANCH
+ if (_ClearcoatInvertSmoothness)
+ {
+ clearcoatRoughness = 1 - clearcoatRoughness;
+ }
+ float3 creflViewDir = getClearcoatAnisotropicReflectionVector(poiCam.viewDir, poiMesh.binormal, poiMesh.tangent.xyz, poiMesh.normals[0], clearcoatRoughness, _ClearcoatAnisotropy);
+ float cndl = saturate(dot(poiLight.direction, poiMesh.normals[0]));
+ float cvdn = abs(dot(poiCam.viewDir, poiMesh.normals[0]));
+ float cndh = saturate(dot(poiMesh.normals[0], poiLight.halfDir));
+
+ float3 clearcoatf0 = 0.16 * clearcoatReflectivity * clearcoatReflectivity;
+ float3 clearcoatFresnel = clearcoatF_Schlick(cvdn, clearcoatf0);
+
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ float attenuation = poiLight.rampedLightMap;
+ #endif
+ #ifdef FORWARD_ADD_PASS
+ float attenuation = saturate(poiLight.nDotL);
+ #endif
+
+ float3 vDirectSpecular = 0;
+ #ifdef VERTEXLIGHT_ON
+ for (int index = 0; index < 4; index++)
+ {
+ float vcndh = saturate(dot(poiMesh.normals[0], poiLight.vHalfDir[index]));
+ float vcndl = saturate(dot(poiLight.vDirection[index], poiMesh.normals[0]));
+ float3 v0directSpecular = getClearcoatDirectSpecular(clearcoatRoughness, vcndh, max(cvdn, 0.000001), vcndl, saturate(poiLight.vDotLH[index]), clearcoatf0, poiLight.halfDir, poiMesh.tangent, poiMesh.binormal, _ClearcoatAnisotropy) * poiLight.vAttenuation * vcndl * poiLight.vColor[index];
+ vDirectSpecular += v0directSpecular;
+ }
+ #endif
+
+ float3 clearcoatDirectSpecular = getClearcoatDirectSpecular(clearcoatRoughness, cndh, max(cvdn, 0.000001), attenuation, saturate(poiLight.lDotH), clearcoatf0, poiLight.halfDir, poiMesh.tangent, poiMesh.binormal, _ClearcoatAnisotropy) * poiLight.attenuation * attenuation * poiLight.color;
+ float3 clearcoatIndirectSpecular = getClearcoatIndirectSpecular(0, clearcoatRoughness, creflViewDir, poiMesh.worldPos, finalColor, poiMesh.normals[0]);
+ float3 clearcoat = ((clearcoatDirectSpecular + vDirectSpecular) * clearCoatMap.g * _ClearcoatEnableSpecular + clearcoatIndirectSpecular * clearCoatMap.b * _ClearcoatEnableReflections) * clearcoatReflectivity * clearcoatFresnel;
+ finalColor.rgb += clearcoat;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiClearCoat.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiClearCoat.cginc.meta
new file mode 100644
index 00000000..479eb681
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiClearCoat.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d63a2851b30d51149aeaeee381068ebc
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiData.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiData.cginc
new file mode 100644
index 00000000..d7d7112f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiData.cginc
@@ -0,0 +1,265 @@
+#ifndef POI_DATA
+#define POI_DATA
+
+float _ParallaxBias;
+float _LightingAdditiveLimitIntensity;
+float _LightingAdditiveMaxIntensity;
+POI_TEXTURE_NOSAMPLER(_BumpMap);
+#ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DetailMask);
+ #endif
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DetailNormalMap);
+ #endif
+ float _DetailNormalMapScale;
+#endif
+float _BumpScale;
+
+void calculateAttenuation(v2f i)
+{
+ #ifdef FORWARD_ADD_PASS
+ #if defined(POINT) || defined(SPOT)
+ POI_LIGHT_ATTENUATION(attenuation, shadow, i, i.worldPos.xyz)
+ poiLight.additiveShadow = shadow;
+ #else
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz)
+ poiLight.additiveShadow == 0;
+ #endif
+ #else
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz)
+ // fix for rare bug where light atten is 0 when there is no directional light in the scene
+ #ifdef FORWARD_BASE_PASS
+ if (all(_LightColor0.rgb == 0.0))
+ {
+ attenuation = 1.0;
+ }
+ #endif
+ #endif
+ poiLight.attenuation = attenuation;
+}
+
+void calculateVertexLightingData(in v2f i)
+{
+ #ifdef VERTEXLIGHT_ON
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vDotNL = max(0, poiLight.vDotNL * corr);
+ poiLight.vAttenuationDotNL = poiLight.vAttenuation * poiLight.vDotNL;
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ UNITY_BRANCH
+ if (_LightingAdditiveLimitIntensity == 1)
+ {
+ float intensity = max(0.001, (0.299 * poiLight.vColor[index].r + 0.587 * poiLight.vColor[index].g + 0.114 * poiLight.vColor[index].b));
+ poiLight.vColor[index] = min(poiLight.vColor[index], poiLight.vColor[index] / (intensity / _LightingAdditiveMaxIntensity));
+ }
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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] = saturate(dot(poiMesh.normals[1], poiLight.vHalfDir[index]));
+ }
+ #endif
+}
+
+void calculateLightingData(in v2f i)
+{
+ poiLight.occlusion = 1;
+ #ifdef FORWARD_BASE_PASS
+ //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 magic = max(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0);
+ float3 normalLight = _LightColor0.rgb;
+ poiLight.color = magic + normalLight;
+ #else
+ #ifdef FORWARD_ADD_PASS
+ poiLight.color = _LightColor0.rgb;
+
+ UNITY_BRANCH
+ if (_LightingAdditiveLimitIntensity == 1)
+ {
+ float additiveLightIntensity = max(0.001, (0.299 * poiLight.color.r + 0.587 * poiLight.color.g + 0.114 * poiLight.color.b));
+ poiLight.color = min(poiLight.color, poiLight.color / (additiveLightIntensity / _LightingAdditiveMaxIntensity));
+ }
+ #endif
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ #endif
+ #endif
+
+ poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir);
+
+ #ifdef POI_VAR_DOTNH
+ poiLight.dotNH = saturate(dot(poiMesh.normals[1], poiLight.halfDir));
+ #endif
+
+ #ifdef POI_VAR_DOTLH
+ poiLight.dotLH = saturate(dot(poiLight.direction, poiLight.halfDir));
+ #endif
+
+ poiLight.nDotV = dot(poiMesh.normals[1], poiCam.viewDir);
+ poiLight.N0DotV = dot(poiMesh.normals[0], poiCam.viewDir);
+ poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction);
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+}
+
+void initPoiMods()
+{
+ poiMods.audioLink = float4(0, 0, 0, 0);
+ poiMods.globalMasks = float4(0, 0, 0, 0);
+ #ifdef POI_AUDIOLINK
+ initAudioBands();
+ #endif
+}
+
+void InitializeMeshData(inout v2f i, uint facing)
+{
+ poiMesh.isFrontFace = facing;
+ poiMesh.normals[0] = normalize(i.normal);
+ poiMesh.binormal.rgb = normalize(i.binormal);
+ poiMesh.tangent = i.tangent;
+
+ #ifndef OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.barycentricCoordinates = i.barycentricCoordinates;
+ poiMesh.uv[0] = i.uv0.xy;
+ poiMesh.uv[1] = i.uv0.zw;
+ poiMesh.uv[2] = i.uv1.xy;
+ poiMesh.uv[3] = i.uv1.zw;
+
+ initPoiMods();
+
+ #ifdef POI_UV_DISTORTION
+ poiMesh.uv[4] = calculateDistortionUV(i.uv0.xy);
+ #else
+ poiMesh.uv[4] = poiMesh.uv[0];
+ #endif
+
+ poiMesh.vertexColor = i.vertexColor;
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.modelPos = i.modelPos;
+
+ #ifdef FUR
+ poiMesh.furAlpha = i.furAlpha;
+ #endif
+}
+
+void initializeCamera(v2f i)
+{
+ poiCam.viewDir = normalize(_WorldSpaceCameraPos - i.worldPos.xyz);
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.clipPos = i.pos;
+ #if defined(GRAIN)
+ poiCam.worldDirection = i.worldDirection;
+ #endif
+
+ poiCam.tangentViewDir = normalize(i.tangentViewDir);
+ poiCam.decalTangentViewDir = poiCam.tangentViewDir;
+ poiCam.tangentViewDir.xy /= (poiCam.tangentViewDir.z + _ParallaxBias);
+}
+
+void calculateTangentData()
+{
+ poiTData.tangentTransform = float3x3(poiMesh.tangent.xyz, poiMesh.binormal, poiMesh.normals[0]);
+ poiTData.tangentToWorld = transpose(float3x3(poiMesh.tangent.xyz, poiMesh.binormal, poiMesh.normals[0]));
+}
+
+void CalculateReflectionData()
+{
+ #if defined(_METALLICGLOSSMAP) || defined(_COLORCOLOR_ON)
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ #endif
+}
+
+void calculateNormals(inout half3 detailMask)
+{
+ half3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiMesh.uv[_BumpMapUV], _BumpMapPan), _BumpScale);
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiMesh.uv[_DetailMaskUV], _DetailMaskPan).rgb;
+ #else
+ detailMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DetailNormalMapScale > 0)
+ {
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiMesh.uv[_DetailNormalMapUV], _DetailNormalMapPan), _DetailNormalMapScale * detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(mainNormal, detailNormal);
+ #else
+ poiMesh.tangentSpaceNormal = mainNormal;
+ #endif
+ }
+ else
+ {
+ poiMesh.tangentSpaceNormal = mainNormal;
+ }
+ #else
+ poiMesh.tangentSpaceNormal = mainNormal;
+ #endif
+
+ #ifdef POI_RGBMASK
+ calculateRGBNormals(poiMesh.tangentSpaceNormal);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ poiCam.viewDotNormal = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiData.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiData.cginc.meta
new file mode 100644
index 00000000..aaea2a06
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiData.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 782c66f5e0b134b408c73197a4a83fc6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDebug.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDebug.cginc
new file mode 100644
index 00000000..961b5fb7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDebug.cginc
@@ -0,0 +1,107 @@
+#ifndef POI_DEBUG
+ #define POI_DEBUG
+
+ float _DebugEnabled;
+ float _DebugMeshData;
+ float _DebugLightingData;
+ float _DebugCameraData;
+
+ void displayDebugInfo(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if (_DebugEnabled != 0)
+ {
+ //Mesh Data
+ if (_DebugMeshData == 1)
+ {
+ finalColor.rgb = poiMesh.normals[0];
+ return;
+ }
+ else if(_DebugMeshData == 2)
+ {
+ finalColor.rgb = poiMesh.normals[1];
+ return;
+ }
+ else if(_DebugMeshData == 3)
+ {
+ finalColor.rgb = poiMesh.tangent;
+ return;
+ }
+ else if(_DebugMeshData == 4)
+ {
+ finalColor.rgb = poiMesh.binormal;
+ return;
+ }
+ else if(_DebugMeshData == 5)
+ {
+ finalColor.rgb = poiMesh.localPos;
+ return;
+ }
+
+ #ifdef POI_LIGHTING
+ if(_DebugLightingData == 1)
+ {
+ finalColor.rgb = poiLight.attenuation;
+ return;
+ }
+ else if(_DebugLightingData == 2)
+ {
+ finalColor.rgb = poiLight.directLighting;
+ return;
+ }
+ else if(_DebugLightingData == 3)
+ {
+ finalColor.rgb = poiLight.indirectLighting;
+ return;
+ }
+ else if(_DebugLightingData == 4)
+ {
+ finalColor.rgb = poiLight.lightMap;
+ return;
+ }
+ else if(_DebugLightingData == 5)
+ {
+ finalColor.rgb = poiLight.rampedLightMap;
+ return;
+ }
+ else if(_DebugLightingData == 6)
+ {
+ finalColor.rgb = poiLight.finalLighting;
+ return;
+ }
+ else if(_DebugLightingData == 7)
+ {
+ finalColor.rgb = poiLight.nDotL;
+ return;
+ }
+ #endif
+
+ if(_DebugCameraData == 1)
+ {
+ finalColor.rgb = poiCam.viewDir;
+ return;
+ }
+ else if(_DebugCameraData == 2)
+ {
+ finalColor.rgb = poiCam.tangentViewDir;
+ return;
+ }
+ else if(_DebugCameraData == 3)
+ {
+ finalColor.rgb = poiCam.forwardDir;
+ return;
+ }
+ else if(_DebugCameraData == 4)
+ {
+ finalColor.rgb = poiCam.worldPos;
+ return;
+ }
+ else if(_DebugCameraData == 5)
+ {
+ finalColor.rgb = poiCam.viewDotNormal;
+ return;
+ }
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDebug.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDebug.cginc.meta
new file mode 100644
index 00000000..13b96281
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDebug.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 351916214630cc448b0ee1e9c69d0de4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDecal.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDecal.cginc
new file mode 100644
index 00000000..5e1b64ef
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDecal.cginc
@@ -0,0 +1,331 @@
+#ifndef POI_DECAL
+#define POI_DECAL
+
+
+#if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalMask);
+#endif
+
+#if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalTexture);
+#else
+ float2 _DecalTextureUV;
+#endif
+float4 _DecalColor;
+fixed _DecalTiled;
+float _DecalBlendType;
+half _DecalRotation;
+half2 _DecalScale;
+half2 _DecalPosition;
+half _DecalRotationSpeed;
+float _DecalEmissionStrength;
+float _DecalBlendAlpha;
+float _DecalHueShiftEnabled;
+float _DecalHueShift;
+float _DecalHueShiftSpeed;
+
+// Audio Link
+half _AudioLinkDecal0ScaleBand;
+float4 _AudioLinkDecal0Scale;
+half _AudioLinkDecal0RotationBand;
+float2 _AudioLinkDecal0Rotation;
+half _AudioLinkDecal0AlphaBand;
+float2 _AudioLinkDecal0Alpha;
+half _AudioLinkDecal0EmissionBand;
+float2 _AudioLinkDecal0Emission;
+
+half _AudioLinkDecal1ScaleBand;
+float4 _AudioLinkDecal1Scale;
+half _AudioLinkDecal1RotationBand;
+float2 _AudioLinkDecal1Rotation;
+half _AudioLinkDecal1AlphaBand;
+float2 _AudioLinkDecal1Alpha;
+half _AudioLinkDecal1EmissionBand;
+float2 _AudioLinkDecal1Emission;
+
+half _AudioLinkDecal2ScaleBand;
+float4 _AudioLinkDecal2Scale;
+half _AudioLinkDecal2RotationBand;
+float2 _AudioLinkDecal2Rotation;
+half _AudioLinkDecal2AlphaBand;
+float2 _AudioLinkDecal2Alpha;
+half _AudioLinkDecal2EmissionBand;
+float2 _AudioLinkDecal2Emission;
+
+half _AudioLinkDecal3ScaleBand;
+float4 _AudioLinkDecal3Scale;
+half _AudioLinkDecal3RotationBand;
+float2 _AudioLinkDecal3Rotation;
+half _AudioLinkDecal3AlphaBand;
+float2 _AudioLinkDecal3Alpha;
+half _AudioLinkDecal3EmissionBand;
+float2 _AudioLinkDecal3Emission;
+
+#ifdef GEOM_TYPE_BRANCH_DETAIL
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalTexture1);
+ #else
+ float2 _DecalTexture1UV;
+ #endif
+ float4 _DecalColor1;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+#endif
+
+#ifdef GEOM_TYPE_FROND
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalTexture2);
+ #else
+ float2 _DecalTexture2UV;
+ #endif
+ float4 _DecalColor2;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+#endif
+
+#ifdef DEPTH_OF_FIELD_COC_VIEW
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalTexture3);
+ #else
+ float2 _DecalTexture3UV;
+ #endif
+ float4 _DecalColor3;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+#endif
+
+// Parallax
+float _Decal0Depth;
+float _Decal1Depth;
+float _Decal2Depth;
+float _Decal3Depth;
+
+float2 calcParallax(float height)
+{
+ return((height * - 1) + 1) * (poiCam.decalTangentViewDir.xy / poiCam.decalTangentViewDir.z);
+}
+
+
+float2 decalUV(float uvNumber, float2 position, half rotation, half rotationSpeed, half2 scale, float depth)
+{
+ float2 uv = poiMesh.uv[uvNumber] + calcParallax(depth + 1);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position, scale / 2 + position, float2(0, 0), float2(1, 1));
+ return uv;
+}
+
+inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+{
+ UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+}
+
+inline float applyTilingClipping(float enabled, float2 uv)
+{
+ float ret = 1;
+ UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+}
+
+void applyDecals(inout float4 albedo, inout float3 decalEmission)
+{
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiMesh.uv[_DecalMaskUV], _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ decalScale = _DecalScale;
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ }
+ #endif
+ uv = decalUV(_DecalTextureUV, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _Decal0Depth);
+ decalColor = POI2D_SAMPLER_PAN(_DecalTexture, _MainTex, uv, _DecalTexturePan) * _DecalColor;
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _Decal0Depth);
+ decalColor = _DecalColor;
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask.r;
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ albedo.rgb = lerp(albedo.rgb, customBlend(albedo.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ decalEmission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ }
+ #endif
+ uv = decalUV(_DecalTexture1UV, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _Decal1Depth);
+ decalColor = POI2D_SAMPLER_PAN(_DecalTexture1, _MainTex, uv, _DecalTexture1Pan) * _DecalColor1;
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _Decal1Depth);
+ decalColor = _DecalColor1;
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask.g;
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ albedo.rgb = lerp(albedo.rgb, customBlend(albedo.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ decalEmission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ }
+ #endif
+ uv = decalUV(_DecalTexture2UV, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _Decal2Depth);
+ decalColor = POI2D_SAMPLER_PAN(_DecalTexture2, _MainTex, uv, _DecalTexture2Pan) * _DecalColor2;
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _Decal2Depth);
+ decalColor = _DecalColor2;
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask.b;
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ albedo.rgb = lerp(albedo.rgb, customBlend(albedo.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ decalEmission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ }
+ #endif
+ uv = decalUV(_DecalTexture3UV, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _Decal3Depth);
+ decalColor = POI2D_SAMPLER_PAN(_DecalTexture3, _MainTex, uv, _DecalTexture3Pan) * _DecalColor3;
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _Decal3Depth);
+ decalColor = _DecalColor3;
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask.a;
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ albedo.rgb = lerp(albedo.rgb, customBlend(albedo.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ decalEmission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+
+ albedo = saturate(albedo);
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDecal.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDecal.cginc.meta
new file mode 100644
index 00000000..0c298e8a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDecal.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 51060b62d3b15724e92fe9550e7e9391
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDefines.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDefines.cginc
new file mode 100644
index 00000000..4a6cb840
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDefines.cginc
@@ -0,0 +1,22 @@
+#ifndef POI_DEFINES
+ #define POI_DEFINES
+
+ #define DielectricSpec float4(0.04, 0.04, 0.04, 1.0 - 0.04)
+ #define pi float(3.14159265359)
+
+ #ifdef _SPECGLOSSMAP // Specular
+ #ifndef POI_VAR_DOTNH
+ #define POI_VAR_DOTNH
+ #endif
+ #ifndef POI_VAR_DOTLH
+ #define POI_VAR_DOTLH
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED // Lighting
+ #ifndef POI_VAR_DOTNL
+ #define POI_VAR_DOTNL
+ #endif
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDefines.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDefines.cginc.meta
new file mode 100644
index 00000000..3c657494
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDefines.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8c6f615a317fbfa4197f1db9e71be458
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDepthColor.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDepthColor.cginc
new file mode 100644
index 00000000..6e1f834d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDepthColor.cginc
@@ -0,0 +1,129 @@
+#ifndef POI_DEPTH_COLOR
+ #define POI_DEPTH_COLOR
+
+ float4 _DepthGlowColor;
+ float _DepthGlowEmission;
+ float _FadeLength;
+ float _DepthAlphaMin;
+ float _DepthAlphaMax;
+ float _DepthGradientTextureUV;
+ float _DepthGradientBlend;
+
+ #if defined(PROP_DEPTHGRADIENT) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DepthGradient);
+ #endif
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DepthMask);
+ #endif
+
+ /*
+ void applyDepthColor(inout float4 finalColor, inout float3 depthTouchEmission, inout float3 finalEmission, float4 worldDirection, float4 clipPos)
+ {
+ float3 touchEmission = 0;
+ if (!IsInMirror())
+ {
+ float fadeLength = _FadeLength;
+ fadeLength *= 0.01;
+ float depth = DecodeFloatRG(tex2Dproj(_CameraDepthTexture, worldDirection));
+ depth = Linear01Depth(depth);
+ if(depth != 1)
+ {
+ float diff = distance(depth, Linear01Depth(clipPos.z));
+ float intersect = 0;
+ if(diff > 0)
+ {
+ intersect = clamp(1 - smoothstep(0, _ProjectionParams.w * fadeLength, diff), 0, 1);
+ }
+ half4 depthGradient = UNITY_SAMPLE_TEX2D_SAMPLER(_DepthGradient, _MainTex, intersect);
+ half3 depthMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DepthMask, _MainTex, poiMesh.uv[0]);
+ half3 depthColor = depthGradient.rgb * _DepthGlowColor.rgb;
+ finalColor.rgb = lerp(finalColor.rgb, depthColor, intersect * depthMask);
+ finalColor.a *= lerp(_DepthAlphaMax, _DepthAlphaMin, intersect);
+ touchEmission = depthColor * _DepthGlowEmission * intersect * depthMask;
+ }
+ }
+ depthTouchEmission = touchEmission;
+ }
+ */
+
+ inline float CorrectedLinearEyeDepth(float z, float B)
+ {
+ return 1.0 / (z / PM._34 + B);
+ }
+
+ void applyDepthColor(inout float4 finalColor, inout float3 depthTouchEmission, inout float3 finalEmission, in float4 worldDirection)
+ {
+ float3 touchEmission = 0;
+ float fadeLength = _FadeLength;
+ fadeLength *= 0.01;
+
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.xy * 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);
+ float intersect = 0;
+ intersect = clamp(1 - smoothstep(0, fadeLength, diff), 0, 1);
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ half3 depthMask = POI2D_SAMPLER_PAN(_DepthMask, _MainTex, poiMesh.uv[_DepthMaskUV], _DepthMaskPan);
+ #else
+ half3 depthMask = 1;
+ #endif
+
+ half4 depthGradient = 0;
+ half3 depthColor = 0;
+
+ UNITY_BRANCH
+ if (_DepthGradientTextureUV == 0)
+ {
+ #if defined(PROP_DEPTHGRADIENT) || !defined(OPTIMIZER_ENABLED)
+ depthGradient = POI2D_SAMPLER_PAN(_DepthGradient, _MainTex, float2(intersect, intersect), _DepthGradientPan);
+ #else
+ depthGradient = 1;
+ #endif
+ depthColor = depthGradient.rgb * _DepthGlowColor.rgb;
+ }
+ else
+ {
+ #if defined(PROP_DEPTHGRADIENT) || !defined(OPTIMIZER_ENABLED)
+ depthGradient = POI2D_SAMPLER_PAN(_DepthGradient, _MainTex, poiMesh.uv[_DepthGradientUV], _DepthGradientPan);
+ #else
+ depthGradient = 1;
+ #endif
+ depthColor = depthGradient.rgb * _DepthGlowColor.rgb * intersect;
+ }
+
+ UNITY_BRANCH
+ if(_DepthGradientBlend == 0) // rpelace
+ {
+ finalColor.rgb = lerp(finalColor.rgb, depthColor, intersect * depthMask);
+ }
+ else if (_DepthGradientBlend == 1) // add
+ {
+ finalColor.rgb += depthColor * intersect * depthMask;
+ }
+ else if (_DepthGradientBlend == 2) // multiply
+ {
+ finalColor.rgb *= lerp(1, depthColor, intersect * depthMask);
+ }
+ finalColor.a *= lerp(_DepthAlphaMax, _DepthAlphaMin, intersect * depthMask);
+ touchEmission = depthColor * _DepthGlowEmission * intersect * depthMask;
+
+ depthTouchEmission = touchEmission;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDepthColor.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDepthColor.cginc.meta
new file mode 100644
index 00000000..d147eab2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDepthColor.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8c5428d069cfea2409fa2cf17f14671d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDissolve.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDissolve.cginc
new file mode 100644
index 00000000..ee46ba87
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDissolve.cginc
@@ -0,0 +1,237 @@
+#ifndef POI_DISSOLVE
+#define POI_DISSOLVE
+
+float _DissolveType;
+float _DissolveEdgeWidth;
+float4 _DissolveEdgeColor;
+sampler2D _DissolveEdgeGradient; float4 _DissolveEdgeGradient_ST;
+float _DissolveEdgeEmission;
+float4 _DissolveTextureColor;
+
+#if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DissolveToTexture);
+#endif
+
+#if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DissolveNoiseTexture);
+#endif
+
+#if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DissolveDetailNoise);
+#endif
+
+#if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DissolveMask);
+#endif
+
+float _DissolveMaskInvert;
+float _DissolveAlpha;
+float _ContinuousDissolve;
+float _DissolveDetailStrength;
+float _DissolveEdgeHardness;
+float _DissolveInvertNoise;
+float _DissolveInvertDetailNoise;
+float _DissolveToEmissionStrength;
+
+// Point to Point
+float _DissolveP2PWorldLocal;
+float _DissolveP2PEdgeLength;
+float4 _DissolveStartPoint;
+float4 _DissolveEndPoint;
+
+// World Dissolve
+float _DissolveWorldShape;
+float4 _DissolveShapePosition;
+float4 _DissolveShapeRotation;
+float _DissolveShapeScale;
+float _DissolveInvertShape;
+float _DissolveShapeEdgeLength;
+
+float _DissolveAlpha0;
+float _DissolveAlpha1;
+float _DissolveAlpha2;
+float _DissolveAlpha3;
+float _DissolveAlpha4;
+float _DissolveAlpha5;
+float _DissolveAlpha6;
+float _DissolveAlpha7;
+float _DissolveAlpha8;
+float _DissolveAlpha9;
+// Masking
+float _DissolveEmissionSide;
+float _DissolveEmission1Side;
+float _DissolveUseVertexColors;
+
+// Audio Link
+#ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+#endif
+
+float4 edgeColor;
+float edgeAlpha;
+float dissolveAlpha;
+float4 dissolveToTexture;
+
+float _DissolveHueShiftEnabled;
+float _DissolveHueShiftSpeed;
+float _DissolveHueShift;
+float _DissolveEdgeHueShiftEnabled;
+float _DissolveEdgeHueShiftSpeed;
+float _DissolveEdgeHueShift;
+void calculateDissolve(inout float4 albedo, inout float3 dissolveEmission)
+{
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiMesh.uv[_DissolveMaskUV], _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ dissolveToTexture = POI2D_SAMPLER_PAN(_DissolveToTexture, _MainTex, poiMesh.uv[_DissolveToTextureUV], _DissolveToTexturePan) * _DissolveTextureColor;
+ #else
+ dissolveToTexture = _DissolveTextureColor;
+ #endif
+
+ #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveNoiseTexture = POI2D_SAMPLER_PAN(_DissolveNoiseTexture, _MainTex, poiMesh.uv[_DissolveNoiseTextureUV], _DissolveNoiseTexturePan).r;
+ #else
+ float dissolveNoiseTexture = 1;
+ #endif
+
+ float da = _DissolveAlpha
+ + _DissolveAlpha0
+ + _DissolveAlpha1
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkTextureExists)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.y * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ UNITY_BRANCH
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(noise, da + _DissolveEdgeWidth, da, 0, 1) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb: poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #endif
+ albedo = lerp(albedo, dissolveToTexture, dissolveAlpha * .999999);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, TRANSFORM_TEX(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient)) * _DissolveEdgeColor;
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #endif
+ albedo.rgb = lerp(albedo.rgb, edgeColor.rgb, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha));
+ }
+
+ dissolveEmission = lerp(0, dissolveToTexture * _DissolveToEmissionStrength, dissolveAlpha) + lerp(0, edgeColor.rgb * _DissolveEdgeEmission, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha));
+}
+
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDissolve.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDissolve.cginc.meta
new file mode 100644
index 00000000..9843d431
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDissolve.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 91375e0f3cd5b0c479c421a4f2a60725
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDithering.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDithering.cginc
new file mode 100644
index 00000000..1540b5eb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDithering.cginc
@@ -0,0 +1,34 @@
+#ifndef POI_DITHERING
+ #define POI_DITHERING
+ fixed _DitheringEnabled;
+ fixed _DitherGradient;
+
+ half calcDither(half2 grabPos)
+ {
+ half dither = Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ return dither;
+ }
+
+ #ifndef POI_SHADOW
+ void applyDithering(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if (_DitheringEnabled)
+ {
+ half dither = calcDither(poiCam.screenUV.xy);
+ finalColor.a = finalColor.a - (dither * (1 - finalColor.a) * _DitherGradient);
+ }
+ }
+ #else
+ void applyShadowDithering(inout float alpha, float2 screenUV)
+ {
+ UNITY_BRANCH
+ if(_DitheringEnabled)
+ {
+ half dither = calcDither(screenUV);
+ alpha = alpha - (dither * (1 - alpha) * _DitherGradient);
+ }
+ }
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDithering.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDithering.cginc.meta
new file mode 100644
index 00000000..d0d1529c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiDithering.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8b779440542bc4e4ebf90e6dbc3ede82
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEmission.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEmission.cginc
new file mode 100644
index 00000000..9beafd3c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEmission.cginc
@@ -0,0 +1,341 @@
+#ifndef POI_EMISSION
+#define POI_EMISSION
+
+float4 _EmissionColor;
+#if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_EmissionMap);
+#endif
+#if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_EmissionMask);
+#endif
+#if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve); float4 _EmissionScrollingCurve_ST;
+#endif
+float _EmissionBaseColorAsMap;
+float _EmissionStrength;
+float _EnableEmission;
+float _EmissionHueShift;
+float4 _EmissiveScroll_Direction;
+float _EmissiveScroll_Width;
+float _EmissiveScroll_Velocity;
+float _EmissiveScroll_Interval;
+float _EmissionBlinkingEnabled;
+float _EmissiveBlink_Min;
+float _EmissiveBlink_Max;
+float _EmissiveBlink_Velocity;
+float _ScrollingEmission;
+float _EnableGITDEmission;
+float _GITDEMinEmissionMultiplier;
+float _GITDEMaxEmissionMultiplier;
+float _GITDEMinLight;
+float _GITDEMaxLight;
+float _GITDEWorldOrMesh;
+float _EmissionCenterOutEnabled;
+float _EmissionCenterOutSpeed;
+float _EmissionHueShiftEnabled;
+float _EmissionBlinkingOffset;
+float _EmissionScrollingOffset;
+float _EmissionHueShiftSpeed;
+float _EmissionHueShiftSpeed1;
+
+float4 _EmissionColor1;
+#ifdef EFFECT_HUE_VARIATION
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_EmissionMap1);
+ #endif
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_EmissionMask1);
+ #endif
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve1); float4 _EmissionScrollingCurve1_ST;
+ #endif
+#endif
+float _EmissionBaseColorAsMap1;
+float _EmissionStrength1;
+float _EnableEmission1;
+float _EmissionHueShift1;
+float4 _EmissiveScroll_Direction1;
+float _EmissiveScroll_Width1;
+float _EmissiveScroll_Velocity1;
+float _EmissiveScroll_Interval1;
+float _EmissionBlinkingEnabled1;
+float _EmissiveBlink_Min1;
+float _EmissiveBlink_Max1;
+float _EmissiveBlink_Velocity1;
+float _ScrollingEmission1;
+float _EnableGITDEmission1;
+float _GITDEMinEmissionMultiplier1;
+float _GITDEMaxEmissionMultiplier1;
+float _GITDEMinLight1;
+float _GITDEMaxLight1;
+float _GITDEWorldOrMesh1;
+float _EmissionCenterOutEnabled1;
+float _EmissionCenterOutSpeed1;
+float _EmissionHueShiftEnabled1;
+float _EmissionBlinkingOffset1;
+float _EmissionScrollingOffset1;
+
+float _EmissionReplace;
+
+float _EmissionScrollingVertexColor;
+float _EmissionScrollingVertexColor1;
+
+float _EmissionScrollingUseCurve;
+float _EmissionScrollingUseCurve1;
+
+#ifdef POI_AUDIOLINK
+ half _EnableEmissionStrengthAudioLink;
+ half _AudioLinkEmissionStrengthBand;
+ half _EnableEmissionCenterOutAudioLink;
+ half _AudioLinkEmissionCenterOutBand;
+ float2 _AudioLinkAddEmission;
+ half _AudioLinkAddEmissionBand;
+ float2 _EmissionCenterOutAddAudioLink;
+ half _AudioLinkEmissionCenterOutAddBand;
+
+ half _EnableEmission1StrengthAudioLink;
+ half _AudioLinkEmission1StrengthBand;
+ half _EnableEmission1CenterOutAudioLink;
+ half _AudioLinkEmission1CenterOutBand;
+ float2 _AudioLinkAddEmission1;
+ half _AudioLinkAddEmission1Band;
+ float2 _EmissionCenterOutAddAudioLink1;
+ half _AudioLinkEmission1CenterOutAddBand;
+
+ fixed _EmissionCenterOutAudioLinkWidth;
+ fixed _EmissionCenterOutAddAudioLinkwidth;
+ fixed _Emission1CenterOutAudioLinkWidth;
+ fixed _Emission1CenterOutAddAudioLinkwidth;
+#endif
+
+float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh)
+{
+ float glowInTheDarkMultiplier = 1;
+ UNITY_BRANCH
+ if (enabled)
+ {
+ #ifdef POI_LIGHTING
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb): calculateluminance(poiLight.directLighting.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ #endif
+ }
+ return glowInTheDarkMultiplier;
+}
+
+float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+{
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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;
+}
+
+float3 calculateEmissionNew(in float3 baseColor, inout float4 finalColor)
+{
+ // First Emission
+ float3 emission0 = 0;
+ float emissionStrength0 = _EmissionStrength;
+ float3 emissionColor0 = 0;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ UNITY_BRANCH
+ if (_EnableEmissionStrengthAudioLink)
+ {
+ emissionStrength0 *= poiMods.audioLink[_AudioLinkEmissionStrengthBand];
+ }
+ UNITY_BRANCH
+ if (_EnableEmissionCenterOutAudioLink)
+ {
+ emissionStrength0 *= getBandAtTime(_AudioLinkEmissionCenterOutBand, saturate(1 - poiLight.nDotV), _EmissionCenterOutAudioLinkWidth);
+ }
+ emissionStrength0 += lerp(_EmissionCenterOutAddAudioLink.x, _EmissionCenterOutAddAudioLink.y, getBandAtTime(_AudioLinkEmissionCenterOutAddBand, saturate(1 - poiLight.nDotV), _EmissionCenterOutAddAudioLinkwidth));
+ emissionStrength0 += lerp(_AudioLinkAddEmission.x, _AudioLinkAddEmission.y, poiMods.audioLink[_AudioLinkAddEmissionBand]);
+ emissionStrength0 = max(emissionStrength0, 0);
+ }
+ #endif
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiMesh.uv[_EmissionMapUV], _EmissionMapPan).rgb * lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ }
+ #else
+ emissionColor0 = lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ #endif
+
+ UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMaskUV], _EmissionMask) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = emissionStrength0 * emissionColor0;
+
+ #ifdef POI_DISSOLVE
+ UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ emission0 *= lerp(1 - dissolveAlpha, dissolveAlpha, _DissolveEmissionSide);
+ }
+ #endif
+
+ // Second Emission
+ float3 emission1 = 0;
+ float emissionStrength1 = 0;
+ float3 emissionColor1 = 0;
+
+ #ifdef EFFECT_HUE_VARIATION
+ emissionStrength1 = _EmissionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ UNITY_BRANCH
+ if (_EnableEmission1StrengthAudioLink)
+ {
+ emissionStrength1 *= poiMods.audioLink[_AudioLinkEmission1StrengthBand];
+ }
+ UNITY_BRANCH
+ if (_EnableEmission1CenterOutAudioLink)
+ {
+ emissionStrength1 *= getBandAtTime(_AudioLinkEmission1CenterOutBand, saturate(1 - poiLight.nDotV), _Emission1CenterOutAudioLinkWidth);
+ }
+ emissionStrength1 += lerp(_EmissionCenterOutAddAudioLink1.x, _EmissionCenterOutAddAudioLink1.y, getBandAtTime(_AudioLinkEmission1CenterOutAddBand, saturate(1 - poiLight.nDotV), _Emission1CenterOutAddAudioLinkwidth));
+ emissionStrength1 += lerp(_AudioLinkAddEmission1.x, _AudioLinkAddEmission1.y, poiMods.audioLink[_AudioLinkAddEmission1Band]);
+ emissionStrength1 = max(emissionStrength1, 0);
+ }
+ #endif
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiMesh.uv[_EmissionMap1UV], _EmissionMap1Pan) * lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;
+ }
+ #else
+ emissionColor1 = lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;;
+ #endif
+ UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _EmissionHueShiftEnabled1);
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask1, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMask1UV], _EmissionMask1) + _Time.x * _EmissionMask1Pan);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = emissionStrength1 * emissionColor1;
+
+ #ifdef POI_DISSOLVE
+ if (_DissolveEmission1Side != 2)
+ {
+ emission1 *= lerp(1 - dissolveAlpha, dissolveAlpha, _DissolveEmission1Side);
+ }
+ #endif
+ #endif
+ finalColor.rgb = lerp(finalColor.rgb, saturate(emissionColor0 + emissionColor1), saturate(emissionStrength0 + emissionStrength1) * _EmissionReplace * poiMax(emission0 + emission1));
+
+ return emission0 + emission1;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEmission.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEmission.cginc.meta
new file mode 100644
index 00000000..dd138af3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEmission.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b2ab0ba2ff117394ba418d4628f23fa5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc
new file mode 100644
index 00000000..92ed124a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc
@@ -0,0 +1,48 @@
+#ifndef POI_ENVIRONMENTAL_RIM
+ #define POI_ENVIRONMENTAL_RIM
+
+ //enviro rim
+ float _EnableEnvironmentalRim;
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_RimEnviroMask);
+ #endif
+
+ float3 calculateEnvironmentalRimLighting(in float4 albedo)
+ {
+ float enviroRimAlpha = saturate(1 - smoothstep(min(_RimEnviroSharpness, _RimEnviroWidth), _RimEnviroWidth, poiCam.viewDotNormal));
+ _RimEnviroBlur *= 1.7 - 0.7 * _RimEnviroBlur;
+
+ float3 enviroRimColor = 0;
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.normals[1], _RimEnviroBlur * UNITY_SPECCUBE_LOD_STEPS);
+ enviroRimColor = DecodeHDR(reflectionData, unity_SpecCube0_HDR);
+ }
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ half enviroMask = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #else
+ half enviroMask = 1;
+ #endif
+ return lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * albedo.rgb), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta
new file mode 100644
index 00000000..c4b4dc47
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c64d73fdd3833694d90dc70276bfb1e0
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFlipbook.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFlipbook.cginc
new file mode 100644
index 00000000..f600ced0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFlipbook.cginc
@@ -0,0 +1,221 @@
+#ifndef POI_FLIPBOOK
+#define POI_FLIPBOOK
+
+#if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST;
+#endif
+#if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_FlipbookMask);
+#endif
+
+float4 _FlipbookColor;
+float _FlipbookFPS;
+float _FlipbookTotalFrames;
+float4 _FlipbookScaleOffset;
+float _FlipbookTiled;
+float _FlipbookCurrentFrame;
+float _FlipbookEmissionStrength;
+float _FlipbookRotation;
+float _EnableFlipbook;
+float _FlipbookTexArrayUV;
+float _FlipbookAlphaControlsFinalAlpha;
+float _FlipbookRotationSpeed;
+float _FlipbookIntensityControlsAlpha;
+float _FlipbookColorReplaces;
+float2 _FlipbookTexArrayPan;
+
+// blending
+float _FlipbookReplace;
+float _FlipbookMultiply;
+float _FlipbookAdd;
+
+// anim
+float _FlipbookMovementType;
+float4 _FlipbookStartEndOffset;
+float _FlipbookMovementSpeed;
+
+// Crossfade
+float _FlipbookCrossfadeEnabled;
+float2 _FlipbookCrossfadeRange;
+
+float _FlipbookHueShiftEnabled;
+float _FlipbookHueShiftSpeed;
+float _FlipbookHueShift;
+// Global
+float4 flipBookPixel;
+float4 flipBookPixelMultiply;
+float flipBookMask;
+
+// Audio Link
+half _AudioLinkFlipbookScaleBand;
+half4 _AudioLinkFlipbookScale;
+half _AudioLinkFlipbookAlphaBand;
+half2 _AudioLinkFlipbookAlpha;
+half _AudioLinkFlipbookEmissionBand;
+half2 _AudioLinkFlipbookEmission;
+half _AudioLinkFlipbookFrameBand;
+half2 _AudioLinkFlipbookFrame;
+
+#ifndef POI_SHADOW
+
+ void applyFlipbook(inout float4 finalColor, inout float3 flipbookEmission)
+ {
+
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ flipBookMask = 1;
+ #endif
+ float4 flipbookScaleOffset = _FlipbookScaleOffset;
+
+ #ifdef POI_AUDIOLINK
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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);
+
+ float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(0, 0), float2(1, 1));
+
+ UNITY_BRANCH
+ if (_FlipbookTiled == 0)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ flipBookPixel = 0;
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ if (_FlipbookCurrentFrame < 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ #ifdef POI_AUDIOLINK
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = _FlipbookColor.rgb;
+ }
+ else
+ {
+ flipBookPixel.rgb *= _FlipbookColor.rgb;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ flipbookAlpha = saturate(lerp(_AudioLinkFlipbookAlpha.x, _AudioLinkFlipbookAlpha.y, poiMods.audioLink[_AudioLinkFlipbookAlphaBand]));
+ #endif
+
+ finalColor.rgb = lerp(finalColor.rgb, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ finalColor.rgb = finalColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ finalColor.rgb = finalColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ UNITY_BRANCH
+ if (_FlipbookAlphaControlsFinalAlpha)
+ {
+ finalColor.a = lerp(finalColor.a, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ flipbookEmissionStrength += max(lerp(_AudioLinkFlipbookEmission.x, _AudioLinkFlipbookEmission.y, poiMods.audioLink[_AudioLinkFlipbookEmissionBand]), 0);
+ #endif
+ flipbookEmission = lerp(0, flipBookPixel.rgb * flipbookEmissionStrength, flipBookPixel.a * _FlipbookColor.a * flipBookMask * flipbookAlpha);
+ }
+
+#else
+
+ float applyFlipbookAlphaToShadow(float2 uv)
+ {
+ UNITY_BRANCH
+ if (_FlipbookAlphaControlsFinalAlpha)
+ {
+ float flipbookShadowAlpha = 0;
+
+ float4 flipbookScaleOffset = _FlipbookScaleOffset;
+ flipbookScaleOffset.xy = 1 - flipbookScaleOffset.xy;
+ float theta = radians(_FlipbookRotation);
+
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ 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);
+
+ float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(0, 0), float2(1, 1));
+
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ if (_FlipbookCurrentFrame < 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+
+ half4 flipbookColor = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipbookColor = lerp(flipbookColor, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ half4 flipbookColor = 1;
+ #endif
+
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipbookColor.a = poiMax(flipbookColor.rgb);
+ }
+
+ UNITY_BRANCH
+ if (_FlipbookTiled == 0)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ flipbookColor.a = 0;
+ }
+ }
+ return flipbookColor.a * _FlipbookColor.a;
+ }
+ return 1;
+ }
+
+#endif
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFlipbook.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFlipbook.cginc.meta
new file mode 100644
index 00000000..6aadb587
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFlipbook.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c711d4f7293f1eb4c814a82da252157c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFrag.cginc
new file mode 100644
index 00000000..54f4b239
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFrag.cginc
@@ -0,0 +1,422 @@
+#ifndef POIFRAG
+#define POIFRAG
+
+float _MainEmissionStrength;
+float _IgnoreFog;
+half _GIEmissionMultiplier;
+float _IridescenceTime;
+float _AlphaToMask;
+float _ForceOpaque;
+float _commentIfZero_EnableGrabpass;
+float _AlphaPremultiply;
+float2 _MainTexPan;
+float _MainTextureUV;
+float _LightingAdditiveEnable;
+
+// Post Processing
+float _PPLightingMultiplier;
+float _PPEmissionMultiplier;
+
+float4 frag(v2f i, uint facing: SV_IsFrontFace): SV_Target
+{
+ #ifdef FORWARD_ADD_PASS
+ #if !defined(POI_LIGHTING)
+ return 0;
+ #endif
+ UNITY_BRANCH
+ if (_LightingAdditiveEnable == 0)
+ {
+ return 0;
+ }
+ #endif
+ UNITY_SETUP_INSTANCE_ID(i);
+ // Color
+ float4 albedo = 1;
+ float4 finalColor = 1;
+
+ // Lighting
+ float bakedCubemap = 0; // Whether or not metallic should run before or after lighting multiplication
+ float3 finalSpecular0 = 0;
+ float3 finalSpecular1 = 0;
+ float3 finalSSS = 0;
+ fixed lightingAlpha = 1;
+ float3 finalEnvironmentalRim = 0;
+
+ // Emissions
+ float3 finalEmission = 0;
+ float3 finalLighting = 1;
+ float3 emissionLighting = 1;
+ float3 IridescenceEmission = 0;
+ float3 spawnInEmission = 0;
+ float3 voronoiEmission = 0;
+ float3 matcapEmission = 0;
+ float3 depthTouchEmission = 0;
+ float3 decalEmission = 0;
+ float3 glitterEmission = 0;
+ float3 panosphereEmission = 0;
+ float3 backFaceEmission = 0;
+ float3 dissolveEmission = 0;
+ float3 rimLightEmission = 0;
+ float3 flipbookEmission = 0;
+ float3 textOverlayEmission = 0;
+ float3 videoEmission = 0;
+ float3 pathEmission = 0;
+ /**********************************************************************
+ Initialize the base data that's needed everywhere else in the shader
+ **********************************************************************/
+ calculateAttenuation(i);
+ InitializeMeshData(i, facing);
+ initializeCamera(i);
+ calculateTangentData();
+
+
+ #ifdef POI_BLACKLIGHT
+ createBlackLightMask();
+ UNITY_BRANCH
+ if (_BlackLightMaskDebug)
+ {
+ return float4(blackLightMask.rgb, 1);
+ }
+ #endif
+
+ // This has to happen in the initializbecause it alters UV data globally
+ #ifdef POI_PARALLAX
+ calculateandApplyParallax();
+ #endif
+
+ // Basically every texture relies on the maintex sampler to function and that's why this is here.
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[_MainTextureUV], _MainTex) + _Time.x * _MainTexPan);
+ half3 detailMask = 1;
+ calculateNormals(detailMask);
+
+ //return float4(poiMesh.binormal.xyz, 1);
+ calculateVertexLightingData(i);
+ /**********************************************************************
+ Calculate Light Maps
+ **********************************************************************/
+ #ifdef POI_DATA
+ calculateLightingData(i);
+ #endif
+ #ifdef POI_LIGHTING
+ calculateBasePassLightMaps();
+ #endif
+
+ /**********************************************************************
+ Calculate Color Data
+ **********************************************************************/
+
+ initTextureData(albedo, mainTexture, backFaceEmission, dissolveEmission, detailMask);
+
+ #ifdef POI_PATHING
+ applyPathing(albedo, pathEmission);
+ #endif
+
+ #ifdef POI_DECAL
+ applyDecals(albedo, decalEmission);
+ #endif
+
+
+ #ifdef POI_IRIDESCENCE
+ UNITY_BRANCH
+ if (_IridescenceTime == 0)
+ {
+ applyIridescence(albedo, IridescenceEmission);
+ }
+ #endif
+
+ #ifdef POI_VORONOI
+ applyVoronoi(albedo, voronoiEmission);
+ #endif
+
+ #ifdef POI_MSDF
+ ApplyTextOverlayColor(albedo, textOverlayEmission);
+ #endif
+
+ #ifdef POI_ENVIRONMENTAL_RIM
+ finalEnvironmentalRim = calculateEnvironmentalRimLighting(albedo);
+ #endif
+
+ #if defined(POI_METAL) || defined(POI_CLEARCOAT)
+ CalculateReflectionData();
+ #endif
+
+ #ifdef POI_DATA
+ distanceFade(albedo);
+ #endif
+
+ #ifdef POI_RANDOM
+ albedo.a *= i.angleAlpha;
+ #endif
+
+ #ifdef MATCAP
+ applyMatcap(albedo, matcapEmission);
+ #endif
+
+ #ifdef PANOSPHERE
+ applyPanosphereColor(albedo, panosphereEmission);
+ #endif
+
+ #ifdef POI_FLIPBOOK
+ applyFlipbook(albedo, flipbookEmission);
+ #endif
+
+ #ifdef POI_GLITTER
+ applyGlitter(albedo, glitterEmission);
+ #endif
+
+ #ifdef POI_RIM
+ applyRimLighting(albedo, rimLightEmission);
+ #endif
+
+ #ifdef POI_DEPTH_COLOR
+ applyDepthColor(albedo, depthTouchEmission, finalEmission, i.worldDirection);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ UNITY_BRANCH
+ if (_IridescenceTime == 1)
+ {
+ applyIridescence(albedo, IridescenceEmission);
+ }
+ #endif
+
+ #ifdef POI_VIDEO
+ applyScreenEffect(albedo, videoEmission);
+ #endif
+
+ applySpawnIn(albedo, spawnInEmission, poiMesh.uv[0], poiMesh.localPos);
+
+ /**********************************************************************
+ Handle a few alpha options
+ **********************************************************************/
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaToMask == 0)
+ {
+ applyDithering(albedo);
+ }
+ }
+
+ albedo.a = max(_ForceOpaque, albedo.a);
+
+ UNITY_BRANCH
+ if (_Mode == 0)
+ {
+ albedo.a = 1;
+ }
+
+ UNITY_BRANCH
+ if (_Mode >= 1)
+ {
+ clip(albedo.a - _Cutoff);
+ }
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ albedo.rgb *= saturate(albedo.a + 0.0000000001);
+ }
+
+ /**********************************************************************
+ Lighting Time :)
+ **********************************************************************/
+
+ #ifdef POI_LIGHTING
+ finalLighting = calculateFinalLighting(albedo.rgb, finalColor);
+ finalLighting = max(finalLighting *= _PPLightingMultiplier, 0);
+
+ if (!_LightingUncapped)
+ {
+ finalLighting = saturate(finalLighting);
+ }
+
+ #ifdef SUBSURFACE
+ finalSSS = calculateSubsurfaceScattering();
+ //finalSSS = calculateSubsurfaceScattering(albedo);
+ #endif
+ #endif
+
+ float4 finalColorBeforeLighting = albedo;
+ finalColor = finalColorBeforeLighting;
+
+ #ifdef POI_SPECULAR
+ finalSpecular0 = calculateSpecular(finalColorBeforeLighting);
+ #endif
+ #ifdef POI_PARALLAX
+ calculateAndApplyInternalParallax(finalColor);
+ #endif
+
+ #ifdef POI_ALPHA_TO_COVERAGE
+ ApplyAlphaToCoverage(finalColor);
+ #endif
+
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaToMask == 1)
+ {
+ applyDithering(finalColor);
+ }
+ }
+
+
+ #ifdef POI_METAL
+ calculateMetallicness();
+ bool probeExists = shouldMetalHappenBeforeLighting();
+ UNITY_BRANCH
+ if (!probeExists)
+ {
+ ApplyMetallicsFake(finalColor, albedo);
+ }
+ #endif
+
+
+ #ifdef POI_LIGHTING
+ emissionLighting = finalLighting;
+ #if defined(FORWARD_ADD_PASS) && defined(POI_METAL)
+ finalLighting *= 1 - metalicMap;
+ #endif
+ applyLighting(finalColor, finalLighting);
+ #endif
+
+ #ifdef POI_BRDF
+ poiBRDF(finalColor, finalColorBeforeLighting);
+ #endif
+
+ #ifdef POI_METAL
+ UNITY_BRANCH
+ if (probeExists)
+ {
+ ApplyMetallics(finalColor, albedo);
+ }
+ #endif
+
+ finalColor.rgb += finalSpecular0 + finalEnvironmentalRim + finalSSS;
+
+ #ifdef FORWARD_BASE_PASS
+ #ifdef POI_CLEARCOAT
+ calculateAndApplyClearCoat(finalColor);
+ #endif
+ #endif
+
+ finalColor.a = saturate(finalColor.a);
+
+ /**********************************************************************
+ Add Up all the emission values :D
+ **********************************************************************/
+ //#if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ finalEmission += finalColorBeforeLighting.rgb * _MainEmissionStrength * albedo.a;
+ finalEmission += wireframeEmission;
+ finalEmission += IridescenceEmission;
+ finalEmission += spawnInEmission;
+ finalEmission += voronoiEmission;
+ finalEmission += matcapEmission;
+ finalEmission += depthTouchEmission;
+ finalEmission += decalEmission;
+ finalEmission += glitterEmission;
+ finalEmission += panosphereEmission;
+ finalEmission += backFaceEmission;
+ finalEmission += rimLightEmission;
+ finalEmission += flipbookEmission;
+ finalEmission += videoEmission;
+ finalEmission += textOverlayEmission;
+ finalEmission += dissolveEmission;
+ finalEmission += pathEmission;
+ #ifdef POI_EMISSION
+ finalEmission += calculateEmissionNew(finalColorBeforeLighting.rgb, finalColor);
+ #endif
+
+ finalEmission = max(finalEmission * _PPEmissionMultiplier, 0);
+
+ //#endif
+ // Compensate for HDR lights
+ #if defined(FORWARD_ADD_PASS)
+ finalEmission *= emissionLighting; // TODO: add in vertex lights
+ #else
+ finalEmission *= max(1, emissionLighting);
+ #endif
+
+ /**********************************************************************
+ Meta Pass Hype :D
+ **********************************************************************/
+ #ifdef POI_META_PASS
+ UnityMetaInput meta;
+ UNITY_INITIALIZE_OUTPUT(UnityMetaInput, meta);
+ meta.Emission = finalEmission * _GIEmissionMultiplier;
+ meta.Albedo = saturate(finalColor.rgb);
+ #ifdef POI_SPECULAR
+ meta.SpecularColor = poiLight.color.rgb * _SpecularTint.rgb * lerp(1, albedo.rgb, _SpecularMetallic) * _SpecularTint.a;
+ #else
+ meta.SpecularColor = poiLight.color.rgb * albedo.rgb;
+ #endif
+ return UnityMetaFragment(meta);
+ #endif
+
+ /**********************************************************************
+ Apply Emission to finalColor
+ **********************************************************************/
+ finalColor.rgb += finalEmission;
+
+ /**********************************************************************
+ Grabpass features
+ **********************************************************************/
+
+ UNITY_BRANCH
+ if (_commentIfZero_EnableGrabpass)
+ {
+ applyGrabEffects(finalColor);
+ }
+
+ /**********************************************************************
+ Unity Fog
+ **********************************************************************/
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, finalColor);
+ }
+ #endif
+
+ #ifdef FORWARD_ADD_PASS
+ if (_Mode > 0)
+ {
+ finalColor.rgb *= finalColor.a;
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_Mode == 0)
+ {
+ finalColor.a = 1;
+ }
+
+ #ifdef FORWARD_ADD_PASS
+ //finalColor.rgb = smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5));
+ #endif
+
+ #ifdef POI_DEBUG
+ displayDebugInfo(finalColor);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_AudioLinkTextureVisualization)
+ {
+ finalColor = poiMods.audioLinkTexture;
+ }
+ #endif
+
+ #ifdef FORWARD_ADD_PASS
+ #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) && defined(DIRECTIONAL)
+ return finalColor + albedo * 0.00001;;
+ #endif
+ #endif
+
+ //finalColor.rgb = frac(finalColor.rgb);
+ return finalColor + albedo * 0.00001;
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFrag.cginc.meta
new file mode 100644
index 00000000..00d9ccb4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6b354421436913b4caf56cba82b553b8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFur.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFur.cginc
new file mode 100644
index 00000000..ad51d231
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFur.cginc
@@ -0,0 +1,41 @@
+#ifndef POI_FUR
+ #define POI_FUR
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_FurTexture); float4 _FurTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_FurHeightMap); float4 _FurHeightMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_FurMask); float4 _FurMask_ST;
+ float _FurAO;
+ float4 _FurColor;
+ float _FurLayers;
+ float _FurMinDistance;
+ float _FurMaxDistance;
+ float _FurHeightMapMin;
+ float _FurHeightMapMax;
+ float _FurDebug;
+ float _AoRampMin;
+ float _AoRampMax;
+ float _FurTipAlpha;
+ float _FurFadeStart;
+
+ //globals
+ half furHeightMap;
+ half furMask;
+
+ float4 calculateFur(float4 albedo, float4 mainTexture)
+ {
+
+ furHeightMap = UNITY_SAMPLE_TEX2D_SAMPLER(_FurHeightMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _FurHeightMap)).x;
+ furHeightMap = remap(furHeightMap, 0, _FurHeightMapMax, _FurHeightMapMin, 1);
+ furMask = poiMax(UNITY_SAMPLE_TEX2D_SAMPLER(_FurMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _FurMask)).xyz);
+ half3 furTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_FurTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _FurTexture));
+ clip(furHeightMap - poiMesh.furAlpha);
+ clip(furMask - poiMesh.furAlpha);
+
+ albedo.rgb = lerp(mainTexture.rgb, furTexture.rgb * _FurColor.rgb, ceil(poiMesh.furAlpha));
+ albedo.rgb *= lerp(1, smoothstep(_AoRampMin, _AoRampMax, furHeightMap), _FurAO * furMask);
+
+ albedo.a *= smoothstep(1.01, _FurTipAlpha, remapClamped(poiMesh.furAlpha, _FurFadeStart, 1, 0, 1)) + _AlphaMod;
+ return albedo;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFur.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFur.cginc.meta
new file mode 100644
index 00000000..50ceb4e1
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiFur.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e1b5cf1dfb601674185dcb1290adc8df
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGeomFur.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGeomFur.cginc
new file mode 100644
index 00000000..30e9fe8f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGeomFur.cginc
@@ -0,0 +1,37 @@
+float _FurLength;
+float _FurGravityStrength;
+
+[instance(4)]
+[maxvertexcount(16)]
+void geomFur(triangle v2f IN[3], inout TriangleStream < v2f > tristream, uint InstanceID : SV_GSInstanceID)
+{
+ float4 fur_worldPos[3];
+ v2f o_fur[3];
+ float3 offset = (float3(0, -1, 0) * (_FurLength) *_FurGravityStrength);
+
+ for (int i = 0; i < 3; i++)
+ {
+ if (InstanceID == 0) {
+ IN[i].furAlpha = 0;
+ tristream.Append(IN[i]);
+ }
+ o_fur[i] = IN[i];
+ fur_worldPos[i] = float4(IN[i].worldPos + IN[i].normal * _FurLength, 1);
+ }
+ if (InstanceID == 0) {
+ tristream.RestartStrip();
+ }
+ int Total_FurLayers = clamp(floor(_FurLayers * (1 - smoothstep(_FurMinDistance, _FurMaxDistance, distance(IN[0].worldPos, getCameraPosition())))), min(1, _FurLayers), _FurLayers);
+
+ int startLayer = max(int(InstanceID) * 6 - 1, 0);
+ for (int layer = startLayer; layer < Total_FurLayers; layer++) {
+ for (int i = 0; i < 3; i++) {
+ o_fur[i].furAlpha = float(layer+1) / (Total_FurLayers+1);
+ o_fur[i].worldPos = float4(lerp(IN[i].worldPos, fur_worldPos[i] + offset * o_fur[i].furAlpha, o_fur[i].furAlpha),1);
+ o_fur[i].pos = UnityWorldToClipPos(o_fur[i].worldPos);
+ o_fur[i].furAlpha += .01;
+ tristream.Append(o_fur[i]);
+ }
+ tristream.RestartStrip();
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGeomFur.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGeomFur.cginc.meta
new file mode 100644
index 00000000..dc306fb3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGeomFur.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f1df45b2865f4eb4fadd5ed060bf9424
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGlitter.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGlitter.cginc
new file mode 100644
index 00000000..fead7309
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGlitter.cginc
@@ -0,0 +1,274 @@
+#ifndef POI_GLITTER
+ #define POI_GLITTER
+
+ half3 _GlitterColor;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterRandomRotation;
+ float _GlitterTextureRotation;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomSize;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_GlitterMask);
+ #endif
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_GlitterColorMap);
+ #endif
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_GlitterTexture);
+ #endif
+
+ float3 randomFloat3(float2 Seed, float maximum)
+ {
+ return(.5 + float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return(float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + _GlitterSpeed;
+ return float3(sin((_Time.x + rando.x * pi) * speed), sin((_Time.x + rando.y * pi) * speed), sin((_Time.x + rando.z * pi) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ float3 hsv = float3(hue, saturation, value);
+ return HSVtoRGB(hsv);
+ }
+
+ void applyGlitter(inout float4 albedo, inout float3 glitterEmission)
+ {
+
+
+ // Scale
+ float2 st = frac(poiMesh.uv[0] + _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;
+ float2 dank;
+ for (int j = -1; j <= 1; j ++)
+ {
+ for (int i = -1; i <= 1; i ++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if(_GlitterRandomSize)
+ {
+ size = remapClamped(randomFromPoint, 0, 1, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = (1. - step(size, m_dist));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if(_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ switch(_GlitterMode)
+ {
+ case 0:
+ float3 randomRotation = 0;
+ UNITY_BRANCH
+ if(_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+ float3 norm = poiMesh.normals[0];
+
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ }
+
+
+ half3 glitterColor = _GlitterColor;
+ glitterColor *= lerp(1, albedo, _GlitterUseSurfaceColor);
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ glitterColor *= POI2D_SAMPLER_PAN(_GlitterColorMap, _MainTex, poiMesh.uv[_GlitterColorMapUV], _GlitterColorMapPan).rgb;
+ #endif
+ float2 uv = remapClamped(dank, -size, size, 0, 1);
+ UNITY_BRANCH
+ if(_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if(_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, uv, _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiMesh.uv[_GlitterMaskUV], _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if(_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if(_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if(_GlitterBlendType == 1)
+ {
+ albedo.rgb = lerp(albedo.rgb, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ glitterEmission = finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ glitterEmission = finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGlitter.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGlitter.cginc.meta
new file mode 100644
index 00000000..eef07774
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGlitter.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4159de48c98f5f4418aac9370e139a73
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGrab.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGrab.cginc
new file mode 100644
index 00000000..d8a3d424
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGrab.cginc
@@ -0,0 +1,125 @@
+#ifndef POI_GRAB
+ #define POI_GRAB
+
+ float _RefractionIndex;
+ float _RefractionOpacity;
+ float _RefractionChromaticAberattion;
+ float _RefractionEnabled;
+ float _GrabSrcBlend;
+ float _GrabDstBlend;
+ float _GrabPassUseAlpha;
+ float _GrabPassBlendFactor;
+ float _GrabBlurDistance;
+ float _GrabBlurQuality;
+ float _GrabBlurDirections;
+ POI_TEXTURE_NOSAMPLER(_GrabPassBlendMap);
+
+ float4 blur(float2 uv)
+ {
+ float two_pi = 6.28318530718;
+
+ float2 radius = _GrabBlurDistance / _ScreenParams.xy * 100; // Arbitrary constant to match old blur
+ float quality = floor(_GrabBlurQuality);
+ float directions = floor(_GrabBlurDirections);
+
+ // Pixel colour
+ float4 color = tex2D(_PoiGrab, uv);
+
+ float deltaAngle = two_pi / directions;
+ float deltaQuality = 1.0 / quality;
+ for (int i = 0; i < directions; i ++)
+ {
+ for (int j = 0; j < quality; j ++)
+ {
+ float angle = deltaAngle * i + j;
+ float offset = deltaQuality * (j + 1);
+ color += tex2D(_PoiGrab, uv + float2(cos(angle), sin(angle)) * radius * offset);
+ }
+ }
+
+ // Output to screen
+ color /= quality * directions + 1;
+ return color;
+ }
+
+ inline float4 Refraction(float indexOfRefraction, float chromaticAberration, float2 projectedGrabPos)
+ {
+ float4 refractionColor;
+ float3 worldViewDir = normalize(UnityWorldSpaceViewDir(poiMesh.worldPos));
+ float3 refractionOffset = ((((indexOfRefraction - 1.0) * mul(UNITY_MATRIX_V, float4(poiMesh.normals[1], 0.0)).xyz) * (1.0 / (poiCam.grabPos.z + 1.0))) * (1.0 - dot(poiMesh.normals[1], worldViewDir)));
+ float2 cameraRefraction = float2(refractionOffset.x, - (refractionOffset.y * _ProjectionParams.x));
+
+ UNITY_BRANCH
+ if (_RefractionChromaticAberattion > 0)
+ {
+ float4 redAlpha = tex2D(_PoiGrab, (projectedGrabPos + cameraRefraction));
+ float green = tex2D(_PoiGrab, (projectedGrabPos + (cameraRefraction * (1.0 - chromaticAberration)))).g;
+ float blue = tex2D(_PoiGrab, (projectedGrabPos + (cameraRefraction * (1.0 + chromaticAberration)))).b;
+ refractionColor = float4(redAlpha.r, green, blue, redAlpha.a);
+ }
+ else
+ {
+ float2 refractedGrab = projectedGrabPos + cameraRefraction;
+
+ #ifdef CHROMATIC_ABERRATION_LOW
+ refractionColor = blur(refractedGrab);
+ #else
+ refractionColor = tex2D(_PoiGrab, (refractedGrab));
+ #endif
+ }
+ return refractionColor;
+ }
+
+ void calculateRefraction(float2 projectedGrabPos, inout float4 finalColor)
+ {
+ float3 refraction = 1;
+ UNITY_BRANCH
+ if(_RefractionEnabled == 1)
+ {
+ refraction = Refraction(_RefractionIndex, _RefractionChromaticAberattion, projectedGrabPos).rgb;
+ }
+ else
+ {
+ #ifdef CHROMATIC_ABERRATION_LOW
+ refraction = blur(projectedGrabPos);
+ #else
+ refraction = tex2Dproj(_PoiGrab, poiCam.grabPos).rgb;
+ #endif
+ }
+
+ float blendFactor = _GrabPassBlendFactor * POI2D_SAMPLER_PAN(_GrabPassBlendMap, _MainTex, poiMesh.uv[_GrabPassBlendMapUV], _GrabPassBlendMapPan).r;
+ UNITY_BRANCH
+ if(_GrabPassUseAlpha)
+ {
+ finalColor = poiBlend(_GrabSrcBlend, finalColor, _GrabDstBlend, float4(refraction, 1), blendFactor * (1 - finalColor.a));
+ finalColor.a = 1;
+ }
+ else
+ {
+ finalColor = poiBlend(_GrabSrcBlend, finalColor, _GrabDstBlend, float4(refraction, 1), blendFactor);
+ }
+ }
+
+ float2 calculateGrabPosition()
+ {
+ float4 grabPos = poiCam.grabPos;
+ #if UNITY_UV_STARTS_AT_TOP
+ float scale = -1.0;
+ #else
+ float scale = 1.0;
+ #endif
+ float halfPosW = grabPos.w * 0.5;
+ grabPos.y = (grabPos.y - halfPosW) * _ProjectionParams.x * scale + halfPosW;
+ #if SHADER_API_D3D9 || SHADER_API_D3D11
+ grabPos.w += 0.00000000001;
+ #endif
+ return(grabPos / grabPos.w).xy;
+ }
+
+ void applyGrabEffects(inout float4 finalColor)
+ {
+ float2 projectedGrabPos = calculateGrabPosition();
+ calculateRefraction(projectedGrabPos, finalColor);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGrab.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGrab.cginc.meta
new file mode 100644
index 00000000..4d91c8c6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiGrab.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 61e29504a29fbea4cbbe44f3107f4e20
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHelpers.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHelpers.cginc
new file mode 100644
index 00000000..32bf369b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHelpers.cginc
@@ -0,0 +1,336 @@
+#ifndef POI_HELPER
+ #define POI_HELPER
+
+ #ifndef pi
+ #define pi float(3.14159265359)
+ #endif
+
+ float linearSin(float x)
+ {
+ return pow(min(cos(pi * x / 2.0), 1.0 - abs(x)), 1.0);
+ }
+
+ 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(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 mod(float3 x, float y)
+ {
+ return x - y * floor(x / y);
+ }
+ float2 mod(float2 x, float y)
+ {
+ return x - y * floor(x / y);
+ }
+
+ //1/7
+ #define K 0.142857142857
+ //3/7
+ #define Ko 0.428571428571
+
+ // Permutation polynomial: (34x^2 + x) mod 289
+ float3 Permutation(float3 x)
+ {
+ return mod((34.0 * x + 1.0) * x, 289.0);
+ }
+
+ bool IsInMirror()
+ {
+ return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f;
+ }
+
+ float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax)
+ {
+ #if UNITY_SPECCUBE_BOX_PROJECTION
+ UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax: boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #endif
+ return direction;
+ }
+
+ // Camera
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ float3 grayscale_vector_node()
+ {
+ return float3(0, 0.3823529, 0.01845836);
+ }
+
+ float3 grayscale_for_light()
+ {
+ return float3(0.298912, 0.586611, 0.114478);
+ }
+
+ //Math Operators
+
+ float remap(float x, float minOld, float maxOld, float minNew, float maxNew)
+ {
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+ }
+
+ float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew)
+ {
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+ }
+
+ float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew)
+ {
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+ }
+
+ float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew)
+ {
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+ }
+
+ float remapClamped(float x, float minOld, float maxOld, float minNew, float maxNew)
+ {
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+ }
+
+ float2 remapClamped(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew)
+ {
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+ }
+
+ float3 remapClamped(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew)
+ {
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+ }
+
+ float4 remapClamped(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew)
+ {
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+ }
+
+ 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);
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+#endif
+
+half2 calcScreenUVs(half4 grabPos)
+{
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #else
+ uv.xy *= _ScreenParams.xy;
+ #endif
+
+ return uv;
+}
+
+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);
+}
+
+// Dithering
+inline half Dither8x8Bayer(int x, int y)
+{
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+}
+
+// UV Manipulation
+float2 TransformUV(half2 offset, half rotation, half2 scale, float2 uv)
+{
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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));
+}
+
+bool isVR()
+{
+ // USING_STEREO_MATRICES
+ #if UNITY_SINGLE_PASS_STEREO
+ return true;
+ #else
+ return false;
+ #endif
+}
+
+bool isVRHandCamera()
+{
+ return !isVR() && abs(UNITY_MATRIX_V[0].y) > 0.0000005;
+}
+
+bool isDesktop()
+{
+ return !isVRHandCamera();
+}
+
+bool isVRHandCameraPreview()
+{
+ return isVRHandCamera() && _ScreenParams.y == 720;
+}
+
+bool isVRHandCameraPicture()
+{
+ return isVRHandCamera() && _ScreenParams.y == 1080;
+}
+
+bool isPanorama()
+{
+ // Crude method
+ // FOV=90=camproj=[1][1]
+ return unity_CameraProjection[1][1] == 1 && _ScreenParams.x == 1075 && _ScreenParams.y == 1025;
+}
+
+float calculateluminance(float3 color)
+{
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHelpers.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHelpers.cginc.meta
new file mode 100644
index 00000000..97285d28
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHelpers.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7e93d7feb25821342bb0bed55596c31e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHologram.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHologram.cginc
new file mode 100644
index 00000000..af9e781d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHologram.cginc
@@ -0,0 +1,44 @@
+#ifndef POI_HOLOGRAM
+#define POI_HOLOGRAM
+
+#if defined(PROP_HOLOALPHAMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_HoloAlphaMap); float4 _HoloAlphaMap_ST;
+#endif
+float _HoloCoordinateSpace; // 0 World, 1 Local, 2 UV
+float3 _HoloDirection;
+float _HoloScrollSpeed;
+float _HoloLineDensity;
+
+fixed _HoloFresnelAlpha;
+fixed _HoloRimSharpness;
+fixed _HoloRimWidth;
+
+void ApplyHoloAlpha(inout float4 color)
+{
+ float uv = 0;
+ UNITY_BRANCH
+ if (_HoloCoordinateSpace == 0)
+ {
+ uv = dot(normalize(_HoloDirection), poiMesh.worldPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ UNITY_BRANCH
+ if (_HoloCoordinateSpace == 1)
+ {
+ uv = dot(normalize(_HoloDirection), poiMesh.localPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ UNITY_BRANCH
+ if (_HoloCoordinateSpace == 2)
+ {
+ uv = dot(_HoloDirection, poiMesh.uv[0] * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ float holoRim = saturate(1 - smoothstep(min(_HoloRimSharpness, _HoloRimWidth), _HoloRimWidth, poiCam.viewDotNormal));
+ holoRim = abs(lerp(1, holoRim, _HoloFresnelAlpha));
+ #if defined(PROP_HOLOALPHAMAP) || !defined(OPTIMIZER_ENABLED)
+ fixed holoAlpha = UNITY_SAMPLE_TEX2D_SAMPLER(_HoloAlphaMap, _MainTex, uv).r;
+ #else
+ fixed holoAlpha = 1;
+ #endif
+ color.a *= holoAlpha * holoRim;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHologram.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHologram.cginc.meta
new file mode 100644
index 00000000..924e0983
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiHologram.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 722a892098d070942960b23bd10ae0a6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiIridescence.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiIridescence.cginc
new file mode 100644
index 00000000..053a4d48
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiIridescence.cginc
@@ -0,0 +1,104 @@
+#ifndef POI_IRIDESCENCE
+#define POI_IRIDESCENCE
+#if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceRamp); float4 _IridescenceRamp_ST;
+#endif
+#if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceMask); float4 _IridescenceMask_ST;
+#endif
+#if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceNormalMap); float4 _IridescenceNormalMap_ST;
+#endif
+float _IridescenceNormalUV;
+float _IridescenceMaskUV;
+float _IridescenceNormalSelection;
+float _IridescenceNormalIntensity;
+float _IridescenceNormalToggle;
+float _IridescenceIntensity;
+fixed _IridescenceAddBlend;
+fixed _IridescenceReplaceBlend;
+fixed _IridescenceMultiplyBlend;
+float _IridescenceEmissionStrength;
+float _IridescencePanSpeed;
+half _IridescenceOffset;
+
+half _IridescenceHueShiftEnabled;
+half _IridescenceHueShiftSpeed;
+half _IridescenceHueShift;
+
+#ifdef POI_AUDIOLINK
+ half _IridescenceAudioLinkEmissionBand;
+ half2 _IridescenceAudioLinkEmission;
+#endif
+
+//global
+#if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ float3 calculateNormal(float3 baseNormal)
+ {
+
+ float3 normal = UnpackScaleNormal(UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceNormalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[_IridescenceNormalUV], _IridescenceNormalMap)), _IridescenceNormalIntensity);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ normal.z * baseNormal
+ );
+ }
+#endif
+
+void applyIridescence(inout float4 albedo, inout float3 IridescenceEmission)
+{
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ // Use custom normal map
+ UNITY_BRANCH
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(normal);
+ }
+ #endif
+
+ float ndotv = abs(dot(normal, poiCam.viewDir)) + _Time.x * _IridescencePanSpeed + _IridescenceOffset;
+
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ float4 iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, ndotv);
+ #else
+ float4 iridescenceColor = 1;
+ #endif
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 iridescenceMask = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask));
+ #else
+ float4 iridescenceMask = 1;
+ #endif
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_IridescenceHueShiftEnabled)
+ {
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, _IridescenceHueShift + _Time.x * _IridescenceHueShiftSpeed);
+ }
+
+ albedo.rgb = lerp(albedo.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ albedo.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ albedo.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ half emissionStrength = _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmission.x, _IridescenceAudioLinkEmission.y, poiMods.audioLink[_IridescenceAudioLinkEmissionBand]);
+ }
+ #endif
+
+ IridescenceEmission = saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiIridescence.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiIridescence.cginc.meta
new file mode 100644
index 00000000..b1a120f1
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiIridescence.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 75516dbd4684805428795a1c132eaf63
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiLighting.cginc
new file mode 100644
index 00000000..87e3719e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiLighting.cginc
@@ -0,0 +1,981 @@
+
+#ifndef POI_LIGHTING
+#define POI_LIGHTING
+
+float _LightingRampType;
+float _LightingIgnoreAmbientColor;
+float _UseShadowTexture;
+float _LightingEnableAO;
+float _LightingDetailShadowsEnabled;
+
+float _LightingOnlyUnityShadows;
+float _LightingMode;
+float _ForceLightDirection;
+float _ShadowStrength;
+float _OutlineShadowStrength;
+float _ShadowOffset;
+float3 _LightDirection;
+float _ForceShadowStrength;
+float _CastedShadowSmoothing;
+float _AttenuationMultiplier;
+float _EnableLighting;
+float _LightingControlledUseLightColor;
+fixed _LightingStandardSmoothness;
+fixed _LightingStandardControlsToon;
+fixed _LightingMinLightBrightness;
+float _LightingUseShadowRamp;
+float _LightingMinShadowBrightnessRatio;
+fixed _LightingMonochromatic;
+
+fixed _LightingGradientStart;
+fixed _LightingGradientEnd;
+float3 _LightingShadowColor;
+float _AOStrength;
+fixed _LightingDetailStrength;
+fixed _LightingAdditiveDetailStrength;
+fixed _LightingNoIndirectMultiplier;
+fixed _LightingNoIndirectThreshold;
+float _LightingUncapped;
+
+float _LightingDirectColorMode;
+float _LightingIndirectColorMode;
+float _LightingAdditiveType;
+fixed _LightingAdditiveGradientStart;
+fixed _LightingAdditiveGradientEnd;
+fixed _LightingAdditivePassthrough;
+float _LightingDirectAdjustment;
+float _LightingIndirect;
+// HSL JUNK
+float _LightingEnableHSL;
+float _LightingShadowHue;
+float _LightingShadowSaturation;
+float _LightingShadowLightness;
+float _LightingHSLIntensity;
+// UTS Style Shade Mapping
+float4 _1st_ShadeColor;
+float _Use_BaseAs1st;
+float4 _2nd_ShadeColor;
+float _Use_1stAs2nd;
+float _BaseColor_Step;
+float _BaseShade_Feather;
+float _ShadeColor_Step;
+float _1st2nd_Shades_Feather;
+float _Use_1stShadeMapAlpha_As_ShadowMask;
+float _1stShadeMapMask_Inverse;
+float _Tweak_1stShadingGradeMapLevel;
+float _Use_2ndShadeMapAlpha_As_ShadowMask;
+float _2ndShadeMapMask_Inverse;
+float _Tweak_2ndShadingGradeMapLevel;
+// Skin
+float _SkinScatteringProperties;
+float _SssWeight;
+float _SssMaskCutoff ;
+float _SssBias;
+float _SssScale;
+float _SssBumpBlur;
+float4 _SssTransmissionAbsorption;
+float4 _SssColorBleedAoWeights;
+/*
+UNITY_DECLARE_TEX2D_NOSAMPLER(_ToonRamp3);
+half _LightingShadowStrength3;
+half _ShadowOffset3;
+*/
+
+half4 shadowStrength;
+sampler2D _SkinLUT;
+UNITY_DECLARE_TEX2D(_ToonRamp);
+POI_TEXTURE_NOSAMPLER(_1st_ShadeMap);
+POI_TEXTURE_NOSAMPLER(_2nd_ShadeMap);
+POI_TEXTURE_NOSAMPLER(_LightingDetailShadows);
+POI_TEXTURE_NOSAMPLER(_LightingAOTex);
+POI_TEXTURE_NOSAMPLER(_LightingShadowMask);
+
+float3 directLighting;
+float3 indirectLighting;
+/*
+* DJLs code starts here
+*/
+float _LightingWrappedWrap;
+float _LightingWrappedNormalization;
+
+// Green’s model with adjustable energy
+// http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+// Modified for adjustable conservation ratio and over-wrap to directionless
+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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+}
+float3 ShadeSH9_wrapped(float3 normal, float wrap)
+{
+ 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;
+}
+
+/*
+* MIT License
+*
+* Copyright (c) 2018 s-ilent
+*
+* 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
+* 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.
+*/
+
+/*
+* Silent's code starts here
+*/
+
+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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+}
+
+float3 BetterSH9(float3 normal)
+{
+ return BetterSH9(float4(normal, 1));
+}
+
+/*
+* Standard stuff starts here
+*/
+UnityLight CreateLight(float3 normal, fixed detailShadowMap)
+{
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, _AttenuationMultiplier) * detailShadowMap);
+ light.ndotl = DotClamped(normal, poiLight.direction);
+ return light;
+}
+
+float FadeShadows(float attenuation)
+{
+ #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 = lerp(1, poiLight.attenuation, _AttenuationMultiplier);
+ #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)
+{
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ indirectLight.diffuse = min(subtractedLight, indirectLight.diffuse);
+ #endif
+}
+
+float3 weightedBlend(float3 layer1, float3 layer2, float2 weights)
+{
+ return(weights.x * layer1 + weights.y * layer2) / (weights.x + weights.y);
+}
+
+UnityIndirect CreateIndirectLight(float3 normal)
+{
+ UnityIndirect indirectLight;
+ indirectLight.diffuse = 0;
+ indirectLight.specular = 0;
+
+ #if defined(FORWARD_BASE_PASS)
+ #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, normal
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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, normal
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(normal, 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1)));
+ #endif
+ #endif
+
+ float3 reflectionDir = reflect(-poiCam.viewDir, normal);
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = 1 - _LightingStandardSmoothness;
+ envData.reflUVW = BoxProjection(
+ reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube0_ProbePosition,
+ unity_SpecCube0_BoxMin.xyz, unity_SpecCube0_BoxMax.xyz
+ );
+ float3 probe0 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData
+ );
+ envData.reflUVW = BoxProjection(
+ reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz
+ );
+ #if UNITY_SPECCUBE_BLENDING
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 probe1 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0),
+ unity_SpecCube0_HDR, envData
+ );
+ indirectLight.specular = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ indirectLight.specular = probe0;
+ }
+ #else
+ indirectLight.specular = probe0;
+ #endif
+ float occlusion = 1;
+ UNITY_BRANCH
+ if (_LightingEnableAO)
+ {
+ occlusion = lerp(1, POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[_LightingAOTexUV], _LightingAOTexPan).r, _AOStrength);
+ }
+
+ indirectLight.diffuse *= occlusion;
+ indirectLight.diffuse = max(indirectLight.diffuse, _LightingMinLightBrightness);
+ indirectLight.specular *= occlusion;
+ #endif
+
+ return indirectLight;
+}
+
+/*
+* Poiyomi's cool as heck code starts here :smug:
+*/
+
+half PoiDiffuse(half NdotV, half NdotL, half LdotH)
+{
+ half fd90 = 0.5 + 2 * LdotH * LdotH * SmoothnessToPerceptualRoughness(.5);
+ // Two schlick fresnel term
+ half lightScatter = (1 + (fd90 - 1) * Pow5(1 - NdotL));
+ half viewScatter = (1 + (fd90 - 1) * Pow5(1 - NdotV));
+
+ return lightScatter * viewScatter;
+}
+
+float3 ShadeSH9Indirect()
+{
+ return ShadeSH9(half4(0.0, -1.0, 0.0, 1.0));
+}
+
+float3 ShadeSH9Direct()
+{
+ return ShadeSH9(half4(0.0, 1.0, 0.0, 1.0));
+}
+
+float3 ShadeSH9Normal(float3 normalDirection)
+{
+ return ShadeSH9(half4(normalDirection, 1.0));
+}
+
+half3 GetSHLength()
+{
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ x1.b = length(unity_SHBb);
+ return x + x1;
+}
+half3 GetSHDirectionL1()
+{
+ //float3 grayscale = float3(.3, .59, .11);
+ float3 grayscale = float3(.33333, .33333, .33333);
+ half3 r = Unity_SafeNormalize(half3(unity_SHAr.x, unity_SHAr.y, unity_SHAr.z));
+ half3 g = Unity_SafeNormalize(half3(unity_SHAg.x, unity_SHAg.y, unity_SHAg.z));
+ half3 b = Unity_SafeNormalize(half3(unity_SHAb.x, unity_SHAb.y, unity_SHAb.z));
+ return Unity_SafeNormalize(grayscale.r * r + grayscale.g * g + grayscale.b * b);
+}
+float3 GetSHDirectionL1_()
+{
+ // For efficiency, we only get the direction from L1.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+}
+// Returns the value from SH in the lighting direction with the
+// brightest intensity.
+half3 GetSHMaxL1()
+{
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+}
+
+
+float3 calculateRealisticLighting(float4 colorToLight, fixed detailShadowMap)
+{
+ return UNITY_BRDF_PBS(1, 0, 0, _LightingStandardSmoothness, poiMesh.normals[1], poiCam.viewDir, CreateLight(poiMesh.normals[1], detailShadowMap), CreateIndirectLight(poiMesh.normals[1])).xyz;
+}
+
+void calculateBasePassLightMaps()
+{
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ float AOMap = 1;
+ float AOStrength = 0;
+ float3 lightColor = poiLight.color;
+ /*
+ * Generate Basic Light Maps
+ */
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+ #ifndef OUTLINE
+ UNITY_BRANCH
+ if (_LightingEnableAO)
+ {
+ AOMap = POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[_LightingAOTexUV], _LightingAOTexPan).r;
+ AOStrength = _AOStrength;
+ poiLight.occlusion = lerp(1, AOMap, AOStrength);
+ }
+ #ifdef FORWARD_BASE_PASS
+ //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ if (lightExists)
+ {
+ lightColor = _LightColor0.rgb + BetterSH9(float4(0, 0, 0, 1));
+ }
+ else
+ {
+ lightColor = BetterSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb));
+ }
+
+ //lightColor = magic * magiratio + normalLight * normaRatio;
+ //lightColor = magic + normalLight;
+ #endif
+ #endif
+
+ float3 grayscale_vector = float3(.33333, .33333, .33333);
+ 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;
+
+ shadowStrength = 1;
+ #ifndef OUTLINE
+ shadowStrength = POI2D_SAMPLER_PAN(_LightingShadowMask, _MainTex, poiMesh.uv[_LightingShadowMaskUV], _LightingShadowMaskPan) * _ShadowStrength;
+ #else
+ shadowStrength = _OutlineShadowStrength;
+ #endif
+
+ float bw_lightColor = dot(lightColor, grayscale_vector);
+ float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, _AttenuationMultiplier)) + dot(ShadeSH9Normal(poiMesh.normals[1]), grayscale_vector));
+ float bw_bottomIndirectLighting = dot(ShadeSH9Minus, grayscale_vector);
+ float bw_topIndirectLighting = dot(ShadeSH9Plus, grayscale_vector);
+ float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting);
+
+ fixed detailShadow = 1;
+ UNITY_BRANCH
+ if (_LightingDetailShadowsEnabled)
+ {
+ detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingDetailStrength).r;
+ }
+ UNITY_BRANCH
+ if (_LightingOnlyUnityShadows)
+ {
+ poiLight.lightMap = poiLight.attenuation;
+ }
+ else
+ {
+ poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting);
+ }
+ poiLight.lightMap *= detailShadow;
+
+ /*
+ * Decide on light colors
+ */
+
+ indirectLighting = 0;
+ directLighting = 0;
+
+
+
+ UNITY_BRANCH
+ if (_LightingIndirectColorMode == 1)
+ {
+ indirectLighting = BetterSH9(float4(poiMesh.normals[1], 1));
+ }
+ else
+ {
+ indirectLighting = ShadeSH9Minus;
+ }
+
+ poiLight.directLighting = lightColor;
+ poiLight.indirectLighting = indirectLighting;
+
+
+ UNITY_BRANCH
+ if (_LightingDirectColorMode == 0)
+ {
+ 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 * poiLight.occlusion + normalLight;
+ float properLuminance = calculateluminance(magic + normalLight);
+ directLighting = properLightColor * max(0.0001, (target / properLuminance));
+ }
+ else
+ {
+ if (lightExists)
+ {
+ directLighting = _LightColor0.rgb + BetterSH9(float4(0, 0, 0, 1)) * poiLight.occlusion;
+ }
+ else
+ {
+ directLighting = max(BetterSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0);
+ }
+ }
+
+ UNITY_BRANCH
+ if (!_LightingUncapped)
+ {
+ float directluminance = calculateluminance(directLighting);
+ float indirectluminance = calculateluminance(indirectLighting);
+ directLighting = min(directLighting, directLighting / max(0.0001, (directluminance / 1)));
+ indirectLighting = min(indirectLighting, indirectLighting / max(0.0001, (indirectluminance / 1)));
+ }
+
+ directLighting = lerp(directLighting, dot(directLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+ indirectLighting = lerp(indirectLighting, dot(indirectLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+
+
+ if (max(max(indirectLighting.x, indirectLighting.y), indirectLighting.z) <= _LightingNoIndirectThreshold && max(max(directLighting.x, directLighting.y), directLighting.z) >= 0)
+ {
+ indirectLighting = directLighting * _LightingNoIndirectMultiplier;
+ }
+
+
+ UNITY_BRANCH
+ if (_LightingMinShadowBrightnessRatio)
+ {
+ float directluminance = clamp(directLighting.r * 0.299 + directLighting.g * 0.587 + directLighting.b * 0.114, 0, 1);
+ if (directluminance > 0)
+ {
+ indirectLighting = max(0.001, indirectLighting);
+ }
+ float indirectluminance = clamp(indirectLighting.r * 0.299 + indirectLighting.g * 0.587 + indirectLighting.b * 0.114, 0, 1);
+ float targetluminance = directluminance * _LightingMinShadowBrightnessRatio;
+ if (indirectluminance < targetluminance)
+ {
+ indirectLighting = indirectLighting / max(0.0001, indirectluminance / targetluminance);
+ }
+ }
+
+ poiLight.rampedLightMap = 1 - smoothstep(0, .5, 1 - poiLight.lightMap);
+ poiLight.finalLighting = directLighting;
+
+ indirectLighting = max(indirectLighting,0);
+ directLighting = max(directLighting,0);
+
+ /*
+ * Create Gradiant Maps
+ */
+ switch(_LightingRampType)
+ {
+ case 0: // Ramp Texture
+
+ {
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength.r);
+ UNITY_BRANCH
+ if (_LightingIgnoreAmbientColor)
+ {
+ poiLight.finalLighting = lerp(poiLight.rampedLightMap * directLighting * poiLight.occlusion, directLighting, poiLight.rampedLightMap);
+ }
+ else
+ {
+ poiLight.finalLighting = lerp(indirectLighting * poiLight.occlusion, directLighting, poiLight.rampedLightMap);
+
+ }
+ }
+ break;
+ case 1: // Math Gradient
+
+ {
+ poiLight.rampedLightMap = saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - poiLight.lightMap));
+ float3 shadowColor = _LightingShadowColor;
+ UNITY_BRANCH
+ if (_UseShadowTexture)
+ {
+ shadowColor = 1;
+ }
+ UNITY_BRANCH
+ if (_LightingIgnoreAmbientColor)
+ {
+ poiLight.finalLighting = lerp((directLighting * shadowColor * poiLight.occlusion), (directLighting), saturate(poiLight.rampedLightMap + 1 - _ShadowStrength));
+ }
+ else
+ {
+ poiLight.finalLighting = lerp((indirectLighting * shadowColor * poiLight.occlusion), (directLighting), saturate(poiLight.rampedLightMap + 1 - _ShadowStrength));
+ }
+ }
+ break;
+ case 2:
+ {
+ poiLight.rampedLightMap = saturate(1 - smoothstep(0, .5, 1 - poiLight.lightMap));
+ poiLight.finalLighting = directLighting;
+ }
+ break;
+ }
+
+ // DJL stuff
+ if (_LightingMode == 2) // Wrapped
+
+ {
+ float wrap = _LightingWrappedWrap;
+
+ float3 directcolor = (_LightColor0.rgb) * saturate(RTWrapFunc(poiLight.nDotL, wrap, _LightingWrappedNormalization));
+ float directatten = lerp(1, poiLight.attenuation, _AttenuationMultiplier);
+
+ uint normalsindex = _LightingIndirectColorMode > 0 ? 1: 0;
+ // if (_LightingIndirectColorMode == 1)
+ // {
+ // surfnormals = poiMesh.normals[1];
+ // }
+ // else
+ // {
+ // surfnormals = poiMesh.normals[0];
+ // }
+ float3 envlight = ShadeSH9_wrapped(poiMesh.normals[normalsindex], wrap);
+ envlight *= poiLight.occlusion;
+
+ poiLight.directLighting = directcolor * detailShadow * directatten;
+ poiLight.indirectLighting = envlight;
+
+
+ float3 ShadeSH9Plus_2 = GetSHMaxL1();
+ float bw_topDirectLighting_2 = dot(_LightColor0.rgb, grayscale_vector);
+ float bw_directLighting = dot(poiLight.directLighting, grayscale_vector);
+ float bw_indirectLighting = dot(poiLight.indirectLighting, grayscale_vector);
+ float bw_topIndirectLighting = dot(ShadeSH9Plus_2, grayscale_vector);
+
+ //poiLight.lightMap = saturate(dot(poiLight.indirectLighting + poiLight.directLighting, grayscale_vector));
+ poiLight.lightMap = smoothstep(0, bw_topIndirectLighting + bw_topDirectLighting_2, bw_indirectLighting + bw_directLighting);
+
+ poiLight.rampedLightMap = 1;
+ UNITY_BRANCH
+ if (_LightingRampType == 0) // Ramp Texture
+
+ {
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength.r);
+ }
+ else if (_LightingRampType == 1) // Math Gradient
+
+ {
+ poiLight.rampedLightMap = lerp(_LightingShadowColor * lerp(poiLight.indirectLighting, 1, _LightingIgnoreAmbientColor), float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - poiLight.lightMap)));
+ poiLight.rampedLightMap = lerp(float3(1, 1, 1), poiLight.rampedLightMap, shadowStrength.r);
+ }
+
+ poiLight.finalLighting = (poiLight.indirectLighting + poiLight.directLighting) * saturate(poiLight.rampedLightMap + 1 - _ShadowStrength);
+ }
+
+ if (!_LightingUncapped)
+ {
+ poiLight.finalLighting = saturate(poiLight.finalLighting);
+ }
+ //poiLight.finalLighting *= .8;
+ #endif
+ }
+
+ /*
+ void applyShadowTexture(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if (_UseShadowTexture && _LightingRampType == 1)
+ {
+ albedo.rgb = lerp(albedo.rgb, POI2D_SAMPLER_PAN(_LightingShadowTexture, _MainTex, poiMesh.uv[_LightingShadowTextureUV], _LightingShadowTexturePan) * _LightingShadowColor, (1 - poiLight.rampedLightMap) * shadowStrength);
+ }
+ }
+ */
+
+ float3 calculateNonImportantLighting(float attenuation, float attenuationDotNL, float3 albedo, float3 lightColor, half dotNL, half correctedDotNL)
+ {
+ fixed detailShadow = 1;
+ UNITY_BRANCH
+ if (_LightingDetailShadowsEnabled)
+ {
+ detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingAdditiveDetailStrength).r;
+ }
+ UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ return lightColor * attenuationDotNL * detailShadow; // Realistic
+ }
+ else if (_LightingAdditiveType == 1) // Toon
+
+ {
+ return lerp(lightColor * attenuation, lightColor * _LightingAdditivePassthrough * attenuation, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, dotNL)) * detailShadow;
+ }
+ else //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-dotNL, _LightingWrappedWrap, _LightingWrappedNormalization)) * detailShadow;
+
+ poiLight.rampedLightMap = 1;
+ if (_LightingRampType == 1) // Math Gradient
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ // TODO: ramp texture or full shade/tint map for atlasing
+
+ return lightColor * poiLight.rampedLightMap * saturate(attenuation * uv);
+ }
+ }
+
+ void applyShadeMaps(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if (_LightingRampType == 2)
+ {
+ float3 baseColor = albedo.rgb;
+
+ 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, poiMesh.uv[_1st_ShadeMapUV], _1st_ShadeMapPan);
+ #else
+ float4 firstShadeMap = float4(1, 1, 1, 1);
+ #endif
+ firstShadeMap = lerp(firstShadeMap, albedo, _Use_BaseAs1st);
+
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 secondShadeMap = POI2D_SAMPLER_PAN(_2nd_ShadeMap, _MainTex, poiMesh.uv[_2nd_ShadeMapUV], _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));
+
+ #if defined(PROP_LIGHTINGSHADOWMASK) || !defined(OPTIMIZER_ENABLED)
+ float removeShadow = POI2D_SAMPLER_PAN(_LightingShadowMask, _MainTex, poiMesh.uv[_LightingShadowMaskUV], _LightingShadowMaskPan).r;
+ #else
+ float removeShadow = 1;
+ #endif
+ mainShadowMask *= removeShadow;
+ firstSecondShadowMask *= removeShadow;
+
+ albedo.rgb = lerp(albedo.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ }
+
+ float3 calculateFinalLighting(inout float3 albedo, float4 finalColor)
+ {
+ float3 finalLighting = 1;
+ // Additive Lighting
+ #ifdef FORWARD_ADD_PASS
+ fixed detailShadow = 1;
+ UNITY_BRANCH
+ if (_LightingDetailShadowsEnabled)
+ {
+ detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingAdditiveDetailStrength).r;
+ }
+ UNITY_BRANCH
+ if (_LightingAdditiveType == 0) // Realistic
+
+ {
+ finalLighting = poiLight.color * poiLight.attenuation * max(0, poiLight.nDotL) * detailShadow * poiLight.additiveShadow;
+ }
+ else if (_LightingAdditiveType == 1) // Toon
+
+ {
+ #if defined(POINT) || defined(SPOT)
+ finalLighting = lerp(poiLight.color * max(poiLight.additiveShadow, _LightingAdditivePassthrough), poiLight.color * _LightingAdditivePassthrough, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * detailShadow;
+ #else
+ finalLighting = lerp(poiLight.color * max(poiLight.attenuation, _LightingAdditivePassthrough), poiLight.color * _LightingAdditivePassthrough, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * detailShadow;
+ #endif
+ }
+ else //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * detailShadow;
+
+ poiLight.rampedLightMap = 1;
+ UNITY_BRANCH
+ if (_LightingRampType == 1) // Math Gradient
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ // TODO: ramp texture or full shade/tint map for atlasing
+ //poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, float2(uv + _ShadowOffset, 1)), shadowStrength.r);
+
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ return poiLight.color * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ }
+ #endif
+
+ // Base and Meta Lighting
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ #ifdef VERTEXLIGHT_ON
+ poiLight.vFinalLighting = 0;
+
+ for (int index = 0; index < 4; index++)
+ {
+ poiLight.vFinalLighting += calculateNonImportantLighting(poiLight.vAttenuation[index], poiLight.vAttenuationDotNL[index], albedo, poiLight.vColor[index], poiLight.vDotNL[index], poiLight.vCorrectedDotNL[index]);
+ }
+ #endif
+
+ switch(_LightingMode)
+ {
+ case 0: // Toon Lighting
+ case 2: // or wrapped
+
+ {
+ // HSL Shading
+ UNITY_BRANCH
+ if (_LightingEnableHSL)
+ {
+ float3 HSLMod = float3(_LightingShadowHue * 2 - 1, _LightingShadowSaturation * 2 - 1, _LightingShadowLightness * 2 - 1) * (1 - poiLight.rampedLightMap);
+ albedo = lerp(albedo.rgb, ModifyViaHSL(albedo.rgb, HSLMod), _LightingHSLIntensity);
+ }
+
+ // Normal Shading
+ UNITY_BRANCH
+ if (_LightingMinLightBrightness > 0)
+ {
+ poiLight.finalLighting = max(0.001, poiLight.finalLighting);
+ float finalluminance = calculateluminance(poiLight.finalLighting);
+ finalLighting = max(poiLight.finalLighting, poiLight.finalLighting / max(0.0001, (finalluminance / _LightingMinLightBrightness)));
+ poiLight.finalLighting = finalLighting;
+ }
+ else
+ {
+ finalLighting = poiLight.finalLighting;
+ }
+ }
+ break;
+ case 1: // realistic
+
+ {
+ fixed detailShadow = 1;
+ UNITY_BRANCH
+ if (_LightingDetailShadowsEnabled)
+ {
+ detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingDetailStrength).r;
+ }
+
+ float3 realisticLighting = calculateRealisticLighting(finalColor, detailShadow).rgb;
+ finalLighting = lerp(realisticLighting, dot(realisticLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+ }
+ break;
+ case 3: // Skin
+
+ {
+ float subsurfaceShadowWeight = 0.0h;
+ float3 ambientNormalWorld = poiMesh.normals[1];//aTangentToWorld(s, s.blurredNormalTangent);
+
+ // Scattering mask.
+ float subsurface = 1;
+ float skinScatteringMask = _SssWeight * saturate(1.0h / _SssMaskCutoff * subsurface);
+ float skinScattering = saturate(subsurface * _SssScale * 2 + _SssBias);
+
+ // Skin subsurface depth absorption tint.
+ // cf http://www.crytek.com/download/2014_03_25_CRYENGINE_GDC_Schultz.pdf pg 35
+ half3 absorption = exp((1.0h - subsurface) * _SssTransmissionAbsorption.rgb);
+
+ // Albedo scale for absorption assumes ~0.5 luminance for Caucasian skin.
+ absorption *= saturate(finalColor.rgb * 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.color, half3(0.2126h, 0.7152h, 0.0722h));
+ float4 sssLookupUv = float4(ndlBlur, skinScattering * lumi, 0.0f, 0.0f);
+ half3 sss = poiLight.lightMap * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ finalLighting = min(lerp(indirectLighting * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * directLighting), directLighting);
+ }
+ break;
+ case 4:
+ {
+ finalLighting = directLighting;
+ }
+ break;
+ }
+ #endif
+ return finalLighting;
+ }
+
+
+ void applyLighting(inout float4 finalColor, float3 finalLighting)
+ {
+ #ifdef VERTEXLIGHT_ON
+ finalColor.rgb *= finalLighting + poiLight.vFinalLighting;
+ #else
+ //finalColor.rgb = blendSoftLight(finalColor.rgb, finalLighting);
+ //finalColor.rgb *= saturate(poiLight.directLighting);
+ finalColor.rgb *= finalLighting;
+ #endif
+ }
+ #endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiLighting.cginc.meta
new file mode 100644
index 00000000..5858c320
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 875615a98ce2df04da90368dd043b09e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMSDF.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMSDF.cginc
new file mode 100644
index 00000000..6339aab5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMSDF.cginc
@@ -0,0 +1,243 @@
+#ifndef POI_MSDF
+ #define POI_MSDF
+
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+
+ float4 _TextFPSColor;
+ half _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ half2 _TextFPSOffset;
+ half2 _TextFPSScale;
+ half _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ half _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ half2 _TextPositionOffset;
+ half2 _TextPositionScale;
+ half _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ half _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ half2 _TextTimeOffset;
+ half2 _TextTimeScale;
+ half _TextTimeRotation;
+
+ #define glyphWidth 0.0625
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+
+ float3 globalTextEmission;
+
+ half2 getAsciiCoordinate(float index)
+ {
+ return half2((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 float4 albedo, float2 uv)
+ {
+ float3 cameraPos = clamp(getCameraPosition(), -999, 999);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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);
+ half2 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(uv, startUV, endUV, 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ albedo.rgb = lerp(albedo.rgb, _TextPositionColor.rgb, opacity * _TextPositionColor.a);
+ globalTextEmission += _TextPositionColor.rgb * opacity * _TextPositionEmissionStrength;
+ }
+
+ void ApplyTimeText(inout float4 albedo, float2 uv)
+ {
+ float instanceTime = _Time.y;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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);
+ half2 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(uv, float2(startUV, 0), float2(endUV, 1), 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ albedo.rgb = lerp(albedo.rgb, _TextTimeColor.rgb, opacity * _TextTimeColor.a);
+ globalTextEmission += _TextTimeColor.rgb * opacity * _TextTimeEmissionStrength;
+ }
+
+ void ApplyFPSText(inout float4 albedo, float2 uv)
+ {
+ float smoothDeltaTime = clamp(unity_DeltaTime.w, 0, 999);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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);
+ half2 glyphPos = getAsciiCoordinate(fpsArray[currentCharacter]);
+ // 0.1428571 = 1/7 = 1 / totalCharacters
+ float startUV = 1 / totalCharacters * currentCharacter;
+ float endUV = 1 / totalCharacters * (currentCharacter + 1);
+
+ fixed4 textFPSPadding = _TextFPSPadding;
+ textFPSPadding *= 1 / totalCharacters;
+ uv = remapClamped(uv, float2(startUV, 0), float2(endUV, 1), 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ albedo.rgb = lerp(albedo.rgb, _TextFPSColor.rgb, opacity * _TextFPSColor.a);
+ globalTextEmission += _TextFPSColor.rgb * opacity * _TextFPSEmissionStrength;
+ }
+
+ void ApplyTextOverlayColor(inout float4 albedo, inout float3 textOverlayEmission)
+ {
+ globalTextEmission = 0;
+ half positionalOpacity = 0;
+ #ifdef EFFECT_BUMP
+ UNITY_BRANCH
+ if(_TextFPSEnabled)
+ {
+ ApplyFPSText(albedo, poiMesh.uv[_TextFPSUV]);
+ }
+ UNITY_BRANCH
+ if(_TextPositionEnabled)
+ {
+ ApplyPositionText(albedo, poiMesh.uv[_TextPositionUV]);
+ }
+ UNITY_BRANCH
+ if(_TextTimeEnabled)
+ {
+ ApplyTimeText(albedo, poiMesh.uv[_TextTimeUV]);
+ }
+
+ textOverlayEmission = globalTextEmission;
+ #endif
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMSDF.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMSDF.cginc.meta
new file mode 100644
index 00000000..b7a42e6c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMSDF.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 84dc625c33bafa94180a82433703016d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMacros.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMacros.cginc
new file mode 100644
index 00000000..60897dea
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMacros.cginc
@@ -0,0 +1,40 @@
+#ifndef POI_MACROS
+ #define POI_MACROS
+
+ #define POI_TEXTURE_NOSAMPLER(tex) Texture2D tex; float4 tex##_ST; float2 tex##Pan; uint tex##UV
+ #define POI_TEXTURE(tex) UNITY_DECLARE_TEX2D(tex##); float4 tex##_ST; float2 tex##Pan; uint tex##UV
+ #define POI_NORMAL_NOSAMPLER(tex) Texture2D tex; float4 tex##_ST; float2 tex##Pan; uint tex##UV; float tex##Scale
+
+ #define POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, TRANSFORM_TEX(uv, tex) + _Time.x * pan))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, TRANSFORM_TEX(uv, tex)))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, TRANSFORM_TEX(uv, tex) + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, TRANSFORM_TEX(uv, tex)))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, TRANSFORM_TEX(uv, tex)))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, TRANSFORM_TEX(uv, tex) + _Time.x * pan))
+
+ #ifdef POINT
+ # define POI_LIGHT_ATTENUATION(destName, shadow, input, worldPos) \
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1)).xyz; \
+ fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \
+ fixed destName = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ #if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS)
+ #define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1))
+ #else
+ #define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = input._LightCoord
+ #endif
+ # define POI_LIGHT_ATTENUATION(destName, shadow, input, worldPos) \
+ DECLARE_LIGHT_COORD(input, worldPos); \
+ fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \
+ fixed destName = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+
+ #if defined(UNITY_COMPILER_HLSL)
+ #define PoiInitStruct(type,name) name = (type)0;
+ #else
+ #define PoiInitStruct(type,name)
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMacros.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMacros.cginc.meta
new file mode 100644
index 00000000..df9ca91e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMacros.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 04ec0d3787161704fbb844ac7d1191ad
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMainTex.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMainTex.cginc
new file mode 100644
index 00000000..0f5cfa5a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMainTex.cginc
@@ -0,0 +1,193 @@
+#ifndef POI_MAINTEXTURE
+#define POI_MAINTEXTURE
+
+
+#if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_ClippingMask);
+#endif
+#if defined(PROP_MAINFADETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MainFadeTexture);
+#endif
+
+float _Inverse_Clipping;
+float4 _Color;
+float _MainVertexColoring;
+float _MainVertexColoringLinearSpace;
+float _MainUseVertexColorAlpha;
+float _Saturation;
+float _MainDistanceFadeMin;
+float _MainDistanceFadeMax;
+half _MainMinAlpha;
+half _MainMaxAlpha;
+float _MainHueShift;
+float _MainFadeType;
+#ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MainColorAdjustTexture);
+ #endif
+ float _MainHueShiftToggle;
+ float _MainHueShiftSpeed;
+ float _MainHueShiftReplace;
+ float _MainSaturationShift;
+ float _MainBrightness;
+#endif
+
+#ifdef FINALPASS
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DetailTex);
+ #endif
+ half _DetailTexIntensity;
+ half3 _DetailTint;
+ float _DetailBrightness;
+#endif
+//globals
+float alphaMask;
+half3 diffColor;
+
+#include "CGI_PoiBackFace.cginc"
+
+float3 wireframeEmission;
+
+inline FragmentCommonData SpecularSetup(float4 i_tex, inout float4 albedo)
+{
+ half4 specGloss = 0;
+ half3 specColor = specGloss.rgb;
+ half smoothness = specGloss.a;
+
+ half oneMinusReflectivity;
+ diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo.rgb, specColor, /*out*/ oneMinusReflectivity);
+
+ FragmentCommonData o = (FragmentCommonData)0;
+ o.diffColor = diffColor;
+ o.specColor = specColor;
+ o.oneMinusReflectivity = oneMinusReflectivity;
+ o.smoothness = smoothness;
+ return o;
+}
+
+inline FragmentCommonData FragmentSetup(float4 i_tex, half3 i_viewDirForParallax, float3 i_posWorld, inout float4 albedo)
+{
+ i_tex = i_tex;
+
+ FragmentCommonData o = SpecularSetup(i_tex, albedo);
+ o.normalWorld = float3(0, 0, 0);
+ o.eyeVec = poiCam.viewDir;
+ o.posWorld = i_posWorld;
+
+ // NOTE: shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha)
+ o.diffColor = PreMultiplyAlpha(o.diffColor, 1, o.oneMinusReflectivity, /*out*/ o.alpha);
+ return o;
+}
+
+void initTextureData(inout float4 albedo, inout float4 mainTexture, inout float3 backFaceEmission, inout float3 dissolveEmission, in half3 detailMask)
+{
+ dissolveEmission = 0;
+
+ #if (defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #ifdef POI_MIRROR
+ applyMirrorTexture(mainTexture);
+ #endif
+ #endif
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiMesh.uv[_ClippingMaskUV], _ClippingMaskPan).r;
+ #else
+ alphaMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ mainTexture.a *= alphaMask;
+
+ #ifndef POI_SHADOW
+ float3 vertexColor = poiMesh.vertexColor.rgb;
+ UNITY_BRANCH
+ if(_MainVertexColoringLinearSpace)
+ {
+ vertexColor = GammaToLinearSpace(poiMesh.vertexColor.rgb);
+ }
+
+ albedo = float4(mainTexture.rgb * max(_Color.rgb, float3(0.000000001, 0.000000001, 0.000000001)) * lerp(1, vertexColor, _MainVertexColoring), mainTexture.a * max(_Color.a, 0.0000001));
+
+ #if defined(POI_LIGHTING) && defined(FORWARD_BASE_PASS)
+ applyShadeMaps(albedo);
+ #endif
+
+ albedo *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+
+ #ifdef POI_RGBMASK
+ albedo.rgb = calculateRGBMask(albedo.rgb);
+ #endif
+
+ albedo.a = saturate(_AlphaMod + albedo.a);
+
+ wireframeEmission = 0;
+ #ifdef POI_WIREFRAME
+ applyWireframe(wireframeEmission, albedo);
+ #endif
+ float backFaceDetailIntensity = 1;
+
+ float mixedHueShift = _MainHueShift;
+ applyBackFaceTexture(backFaceDetailIntensity, mixedHueShift, albedo, backFaceEmission);
+
+ #ifdef POI_FUR
+ albedo = calculateFur(albedo, albedo);
+ #endif
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftReplace)
+ {
+ albedo.rgb = lerp(albedo.rgb, hueShift(albedo.rgb, mixedHueShift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ albedo.rgb = hueShift(albedo.rgb, frac((mixedHueShift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+
+ albedo.rgb = lerp(albedo.rgb, dot(albedo.rgb, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ albedo.rgb = saturate(albedo.rgb + _MainBrightness * hueShiftAlpha.g);
+ #endif
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiMesh.uv[_DetailTexUV], _DetailTexPan).rgb * _DetailTint.rgb;
+ #else
+ half3 detailTexture = 0.21763764082 * _DetailTint.rgb;
+ #endif
+ albedo.rgb *= LerpWhiteTo(detailTexture * _DetailBrightness * unity_ColorSpaceDouble.rgb, detailMask.r * _DetailTexIntensity * backFaceDetailIntensity);
+ #endif
+ albedo.rgb = saturate(albedo.rgb);
+
+ #ifdef POI_HOLOGRAM
+ ApplyHoloAlpha(albedo);
+ #endif
+
+ s = FragmentSetup(float4(poiMesh.uv[0], 1, 1), poiCam.viewDir, poiMesh.worldPos, albedo);
+ #endif
+
+ #ifdef DISTORT
+ calculateDissolve(albedo, dissolveEmission);
+ #endif
+}
+
+void distanceFade(inout float4 albedo)
+{
+ #if defined(PROP_MAINFADETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ half fadeMap = POI2D_SAMPLER_PAN(_MainFadeTexture, _MainTex, poiMesh.uv[_MainFadeTextureUV], _MainFadeTexturePan).r;
+ #else
+ half fadeMap = 1;
+ #endif
+ if (fadeMap)
+ {
+ float fadeDistance = _MainFadeType ? poiCam.distanceToVert : poiCam.distanceToModel;
+ half fadeValue = lerp(_MainMinAlpha, _MainMaxAlpha, smoothstep(_MainDistanceFadeMin, _MainDistanceFadeMax, fadeDistance));
+ albedo.a *= fadeValue;
+ }
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMainTex.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMainTex.cginc.meta
new file mode 100644
index 00000000..bb3c3ce0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMainTex.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 12748a444887090498f6955544f01d6a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMatcap.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMatcap.cginc
new file mode 100644
index 00000000..5d7d0f73
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMatcap.cginc
@@ -0,0 +1,160 @@
+#ifndef MATCAP
+ #define MATCAP
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap); float4 _Matcap_ST;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MatcapMask);
+ #endif
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap2);float4 _Matcap2_ST;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_Matcap2Mask);
+ #endif
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ void blendMatcap(inout float4 finalColor, float add, float multiply, float replace, float4 matcapColor, float matcapMask, inout float3 matcapEmission, float emissionStrength
+ #ifdef POI_LIGHTING
+ , float matcapLightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ #ifdef POI_LIGHTING
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #endif
+ #ifdef POI_BLACKLIGHT
+ if(blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #endif
+
+ finalColor.rgb = lerp(finalColor.rgb, matcapColor.rgb, replace * matcapMask * matcapColor.a * .999999);
+ finalColor.rgb *= lerp(1, matcapColor.rgb, multiply * matcapMask * matcapColor.a);
+ finalColor.rgb += matcapColor.rgb * add * matcapMask * matcapColor.a;
+ matcapEmission += matcapColor.rgb * emissionStrength * matcapMask * matcapColor.a;
+ }
+
+ void applyMatcap(inout float4 finalColor, inout float3 matcapEmission)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+
+ // Both matcaps use the same coordinates
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+
+ // Matcap 1
+ half2 matcapUV = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * _MatcapColor;
+ #else
+ matcap = _MatcapColor;
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiMesh.uv[_MatcapMaskUV], _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ UNITY_BRANCH
+ if(_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(finalColor, _MatcapAdd, _MatcapMultiply, _MatcapReplace, matcap, matcapMask, matcapEmission, _MatcapEmissionStrength
+ #ifdef POI_LIGHTING
+ , _MatcapLightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+ half2 matcapUV2 = half2(dot(worldViewRight, poiMesh.normals[_Matcap2Normal]), dot(worldViewUp, poiMesh.normals[_Matcap2Normal])) * _Matcap2Border + 0.5;
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV2, _Matcap2)) * _Matcap2Color;
+ #else
+ matcap2 = _Matcap2Color;
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiMesh.uv[_Matcap2MaskUV], _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ UNITY_BRANCH
+ if(_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(finalColor, _Matcap2Add, _Matcap2Multiply, _Matcap2Replace, matcap2, matcap2Mask, matcapEmission, _Matcap2EmissionStrength
+ #ifdef POI_LIGHTING
+ , _Matcap2LightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMatcap.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMatcap.cginc.meta
new file mode 100644
index 00000000..f941df29
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMatcap.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 323862fd98ce4bb489e5e9bb6976e7a9
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMath.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMath.cginc
new file mode 100644
index 00000000..e81ff2d5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMath.cginc
@@ -0,0 +1,100 @@
+/*
+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
+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.
+
+VertexTransformShader is dependent on:
+*/
+
+#ifndef POI_MATH
+#define POI_MATH
+
+#ifndef pi
+ #define pi float(3.14159265359)
+#endif
+
+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)
+{
+ return float4(
+ cos(angle / 2.0),
+ normalize(axis) * sin(angle / 2.0)
+ );
+}
+
+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), degree_to_radius(rotation.x));
+ float4 qy = get_quaternion_from_angle(float3(0, 1, 0), degree_to_radius(rotation.y));
+ float4 qz = get_quaternion_from_angle(float3(0, 0, 1), degree_to_radius(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;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMath.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMath.cginc.meta
new file mode 100644
index 00000000..cbbda0dd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMath.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: eadf9f5b726a2764abcd3d6895748ab3
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMetal.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMetal.cginc
new file mode 100644
index 00000000..ed6b64ed
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMetal.cginc
@@ -0,0 +1,130 @@
+#ifndef POI_METAL
+ #define POI_METAL
+
+ samplerCUBE _CubeMap;
+ float _SampleWorld;
+ POI_TEXTURE_NOSAMPLER(_MetallicMask);
+ POI_TEXTURE_NOSAMPLER(_SmoothnessMask);
+ float _Metallic;
+ float _InvertSmoothness;
+ float _Smoothness;
+ float _EnableMetallic;
+ float3 _MetalReflectionTint;
+ POI_TEXTURE_NOSAMPLER(_MetallicTintMap);
+
+ float3 finalreflections;
+ float metalicMap;
+ float3 reflection;
+ float roughness;
+ float lighty_boy_uwu_var;
+
+ bool shouldMetalHappenBeforeLighting()
+ {
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiCam.reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ bool probeExists = !(unity_SpecCube0_HDR.a == 0 && envSample.a == 0);
+ return probeExists && !_SampleWorld;
+ }
+
+ float3 fresnelRelflection(in float4 albedo)
+ {
+ half3 dotNV = 1 - abs(poiLight.nDotV);
+ half f = dotNV * dotNV * dotNV * dotNV;
+ //f *= i_sold.fresnel;
+ return lerp(lerp(DielectricSpec.rgb, albedo.rgb, metalicMap), saturate(1 - roughness + metalicMap), f);
+ }
+
+ void calculateMetallicness()
+ {
+ metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[_MetallicMaskUV], _MetallicMaskPan) * _Metallic;
+ }
+
+ void ApplyMetallics(inout float4 finalColor, in float4 albedo)
+ {
+ #ifdef FORWARD_BASE_PASS
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[_SmoothnessMaskUV], _SmoothnessMaskPan));
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskMetallic != 4)
+ {
+ metalicMap *= blackLightMask[_BlackLightMaskMetallic];
+ smoothnessMap *= blackLightMask[_BlackLightMaskMetallic];
+ }
+ #endif
+
+ if(_InvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _Smoothness;
+ roughness = 1 - smoothnessMap;
+
+
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = roughness;
+ envData.reflUVW = BoxProjection(
+ poiCam.reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube0_ProbePosition,
+ unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax
+ );
+ float3 probe0 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData
+ );
+ envData.reflUVW = BoxProjection(
+ poiCam.reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax
+ );
+
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ float3 probe1 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0),
+ unity_SpecCube0_HDR, envData
+ );
+ reflection = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ reflection = probe0;
+ }
+
+ float reflecty_lighty_boy_uwu_var_2 = 1.0 / (roughness * roughness + 1.0);
+
+ half4 tintMap = POI2D_SAMPLER_PAN(_MetallicTintMap, _MainTex, poiMesh.uv[_MetallicTintMapUV], _MetallicTintMapPan);
+ finalColor.rgb *= (1 - metalicMap * tintMap.a);
+ finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection(albedo) * _MetalReflectionTint * tintMap.rgb * tintMap.a;
+ #endif
+ }
+
+ void ApplyMetallicsFake(inout float4 finalColor, in float4 albedo)
+ {
+ #ifdef FORWARD_BASE_PASS
+ metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[_MetallicMaskUV], _MetallicMaskPan) * _Metallic;
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[_SmoothnessMaskUV], _SmoothnessMaskPan));
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskMetallic != 4)
+ {
+ metalicMap *= blackLightMask[_BlackLightMaskMetallic];
+ smoothnessMap *= blackLightMask[_BlackLightMaskMetallic];
+ }
+ #endif
+
+ if(_InvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _Smoothness;
+ roughness = 1 - smoothnessMap;
+
+ reflection = texCUBElod(_CubeMap, float4(poiCam.reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+
+ float reflecty_lighty_boy_uwu_var_2 = 1.0 / (roughness * roughness + 1.0);
+ half4 tintMap = POI2D_SAMPLER_PAN(_MetallicTintMap, _MainTex, poiMesh.uv[_MetallicTintMapUV], _MetallicTintMapPan);
+ finalColor.rgb *= (1 - metalicMap * tintMap.a);
+ finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection(albedo) * _MetalReflectionTint * tintMap.rgb * tintMap.a;
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMetal.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMetal.cginc.meta
new file mode 100644
index 00000000..2f7e52c6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMetal.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f3c3b7fd3b4e5ef41b58d5b068745571
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMirror.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMirror.cginc
new file mode 100644
index 00000000..b2edec92
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMirror.cginc
@@ -0,0 +1,81 @@
+#ifndef POI_MIRROR
+ #define POI_MIRROR
+
+ float _Mirror;
+ float _EnableMirrorTexture;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MirrorTexture);
+ #endif
+
+
+ void applyMirrorRenderVert(inout float4 vertex)
+ {
+ UNITY_BRANCH
+ if (_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ void applyMirrorRenderFrag()
+ {
+ UNITY_BRANCH
+ if(_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ void applyMirrorTexture(inout float4 mainTexture)
+ {
+ UNITY_BRANCH
+ if(_EnableMirrorTexture)
+ {
+ if(IsInMirror())
+ {
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ mainTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ #endif
+ }
+ }
+ }
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMirror.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMirror.cginc.meta
new file mode 100644
index 00000000..310c38b7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiMirror.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 539faa93b7473644fb6a2c771dd9ea98
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineFrag.cginc
new file mode 100644
index 00000000..1db932e5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineFrag.cginc
@@ -0,0 +1,117 @@
+float _OutlineRimLightBlend;
+float _OutlineLit;
+float _OutlineTintMix;
+float2 _MainTexPan;
+float _MainTextureUV;
+half _OutlineHueOffset;
+half _OutlineHueShift;
+half _OutlineHueOffsetSpeed;
+
+float4 frag(v2f i, uint facing: SV_IsFrontFace): COLOR
+{
+ float4 finalColor = 1;
+ UNITY_BRANCH
+ if (_commentIfZero_EnableOutlinePass)
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+
+ float3 finalEmission = 0;
+ float4 albedo = 1;
+
+ poiMesh.uv[0] = i.uv0.xy;
+ poiMesh.uv[1] = i.uv0.zw;
+ poiMesh.uv[2] = i.uv1.xy;
+ poiMesh.uv[3] = i.uv1.zw;
+
+ calculateAttenuation(i);
+ InitializeMeshData(i, facing);
+ initializeCamera(i);
+ calculateTangentData();
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[_MainTextureUV], _MainTex) + _Time.x * _MainTexPan);
+ half3 detailMask = 1;
+ calculateNormals(detailMask);
+
+ #ifdef POI_DATA
+ calculateLightingData(i);
+ #endif
+ #ifdef POI_LIGHTING
+ calculateBasePassLightMaps();
+ #endif
+
+ float3 uselessData0;
+ float3 uselessData1;
+ initTextureData(albedo, mainTexture, uselessData0, uselessData1, detailMask);
+
+
+ fixed4 col = mainTexture;
+ float alphaMultiplier = smoothstep(_OutlineFadeDistance.x, _OutlineFadeDistance.y, distance(getCameraPosition(), i.worldPos));
+ float OutlineMask = tex2D(_OutlineMask, TRANSFORM_TEX(poiMesh.uv[_OutlineMaskUV], _OutlineMask) + _Time.x * _OutlineMaskPan).r;
+ clip(OutlineMask * _LineWidth - 0.001);
+
+ col = col * 0.00000000001 + tex2D(_OutlineTexture, TRANSFORM_TEX(poiMesh.uv[_OutlineTextureUV], _OutlineTexture) + _Time.x * _OutlineTexturePan);
+ col.a *= albedo.a;
+ col.a *= alphaMultiplier;
+
+ #ifdef POI_RANDOM
+ col.a *= i.angleAlpha;
+ #endif
+
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ col.a *= _LineColor.a;
+
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ applyDithering(col);
+ }
+
+ clip(col.a - _Cutoff);
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderFrag();
+ #endif
+
+ UNITY_BRANCH
+ if (_OutlineMode == 1)
+ {
+ #ifdef POI_MIRROR
+ applyMirrorTexture(mainTexture);
+ #endif
+ col.rgb = mainTexture.rgb;
+ }
+ else if (_OutlineMode == 2)
+ {
+ col.rgb = lerp(col.rgb, poiLight.color, _OutlineRimLightBlend);
+ }
+ col.rgb *= _LineColor.rgb;
+
+ if (_OutlineMode == 1)
+ {
+ col.rgb = lerp(col.rgb, mainTexture.rgb, _OutlineTintMix);
+ }
+
+ finalColor = col;
+
+ // Hue shift
+ UNITY_BRANCH
+ if (_OutlineHueShift)
+ {
+ finalColor.rgb = hueShift(finalColor.rgb, _OutlineHueOffset + _OutlineHueOffsetSpeed * _Time.x);
+ }
+
+ #ifdef POI_LIGHTING
+ UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ finalColor.rgb *= calculateFinalLighting(finalColor.rgb, finalColor);
+ }
+ #endif
+ finalColor.rgb += (col.rgb * _OutlineEmission);
+}
+else
+{
+ clip(-1);
+}
+return finalColor;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineFrag.cginc.meta
new file mode 100644
index 00000000..ebecf7b5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9fd65f94f5fb7e3458dde9fbf2b2375f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineVert.cginc
new file mode 100644
index 00000000..55fb800d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineVert.cginc
@@ -0,0 +1,144 @@
+#ifndef OutlineVert
+#define OutlineVert
+
+#include "CGI_PoiV2F.cginc"
+
+float _OutlineMode;
+float4 _OutlinePersonaDirection;
+float4 _OutlineDropShadowOffset;
+float _OutlineUseVertexColors;
+float _OutlineFixedSize;
+float _commentIfZero_EnableOutlinePass;
+float _OutlinesMaxDistance;
+
+sampler2D _OutlineMask; float4 _OutlineMask_ST; float2 _OutlineMaskPan; float _OutlineMaskUV;
+
+float _VertexManipulationHeightUV;
+
+float3 CreateBinormal(half3 normal, half3 tangent, half tangentSign)
+{
+ half sign = tangentSign * unity_WorldTransformParams.w;
+ return cross(normal, tangent) * sign;
+}
+
+v2f vert(appdata v)
+{
+
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+
+ #ifdef AUTO_EXPOSURE
+ applyLocalVertexTransformation(v.normal, v.tangent, v.vertex);
+ #endif
+
+ UNITY_INITIALIZE_OUTPUT(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicOrifaceSystem(v);
+ #endif
+
+ o.uv0.xy = v.uv0.xy;
+ o.uv0.zw = v.uv1.xy;
+ o.uv1.xy = v.uv2.xy;
+ o.uv1.zw = v.uv3.xy;
+
+ float2 uvArray[4];
+ uvArray[0] = o.uv0.xy;
+ uvArray[1] = o.uv0.zw;
+ uvArray[2] = o.uv1.xy;
+ uvArray[3] = o.uv1.zw;
+
+ float2 uvToUse = uvArray[_VertexManipulationHeightUV];
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderVert(v.vertex);
+ #endif
+
+ o.uv0.xy = v.uv0 + _OutlineGlobalPan.xy * _Time.y;
+ float outlineMask = 1;
+
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(TRANSFORM_TEX(uvArray[_OutlineMaskUV], _OutlineMask) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+ UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ UNITY_BRANCH
+ if (_OutlineUseVertexColors != 1)
+ {
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ }
+ else
+ {
+ o.normal = UnityObjectToWorldNormal(v.color);
+ }
+
+ float4 localPos = v.vertex;
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicPenetrationSystem(localPos.rgb, o.normal.rgb, v);
+ #endif
+ o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
+ o.binormal.rgb = CreateBinormal(o.normal.xyz, o.tangent.xyz, o.tangent.w);
+
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = o.normal * (_LineWidth * _commentIfZero_EnableOutlinePass / 100) * outlineMask * distanceOffset;
+
+ UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = poiLight.direction = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, o.normal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, o.normal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+
+ o.worldPos = mul(unity_ObjectToWorld, localPos) + float4(offset, 0);
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+
+ #ifdef AUTO_EXPOSURE
+ applyWorldVertexTransformation(o.worldPos, o.localPos, o.normal, uvToUse);
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ applyVertexRounding(o.worldPos, o.localPos);
+ #endif
+
+ o.pos = UnityWorldToClipPos(o.worldPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.angleAlpha = 1;
+ #ifdef POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+
+ UNITY_TRANSFER_SHADOW(o, o.uv0);
+ UNITY_TRANSFER_FOG(o, o.pos);
+ return o;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineVert.cginc.meta
new file mode 100644
index 00000000..b09e7702
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiOutlineVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a7efb62b17e21b945bc06340be80d0f6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPanosphere.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPanosphere.cginc
new file mode 100644
index 00000000..7986c320
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPanosphere.cginc
@@ -0,0 +1,80 @@
+#ifndef PANOSPHERE
+ #define PANOSPHERE
+
+ float _PanoEmission;
+ float _PanoBlend;
+ float4 _PanosphereColor;
+ float3 _PanospherePan;
+ float _PanoToggle;
+ float _PanoCubeMapToggle;
+ float _PanoInfiniteStereoToggle;
+
+ float3 panoColor;
+ float panoMask;
+
+ #if defined(PROP_PANOSPHERETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ sampler2D _PanosphereTexture; float4 _PanosphereTexture_ST;
+ #endif
+ #if defined(PROP_PANOCUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _PanoCubeMap; half4 _PanoCubeMap_HDR;
+ #endif
+ #if defined(PROP_PANOMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_PanoMask);
+ #endif
+
+ float2 projectIt(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude + _Time.y * _PanospherePan.x, latitude + _Time.y * _PanospherePan.y) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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;
+ }
+
+ void applyPanosphereColor(inout float4 albedo, inout float3 panosphereEmission)
+ {
+ #if defined(PROP_PANOMASK) || !defined(OPTIMIZER_ENABLED)
+ panoMask = POI2D_SAMPLER_PAN(_PanoMask, _MainTex, poiMesh.uv[_PanoMaskUV], _PanoMaskPan);
+ #else
+ panoMask = 1;
+ #endif
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskPanosphere != 4)
+ {
+ panoMask *= blackLightMask[_BlackLightMaskPanosphere];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if(_PanoCubeMapToggle)
+ {
+ #if defined(PROP_PANOCUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float3 cubeUV = mul(poiRotationMatrixFromAngles(_PanospherePan.xyz * _Time.y), float4(-poiCam.viewDir, 1));
+ half4 cubemap = texCUBE(_PanoCubeMap, cubeUV);
+ panoColor = DecodeHDR(cubemap, _PanoCubeMap_HDR) * _PanosphereColor.rgb;
+ #else
+ panoColor = _PanosphereColor.rgb;
+ #endif
+ }
+ else
+ {
+ float2 uv = projectIt(normalize(lerp(getCameraPosition().xyz, poiCam.worldPos.xyz, _PanoInfiniteStereoToggle) - poiMesh.worldPos.xyz) * - 1);
+
+ float2 ddxuv = ddx(uv);
+ float2 ddyuv = ddy(uv);
+ if(any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ #if defined(PROP_PANOSPHERETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ panoColor = tex2D(_PanosphereTexture, TRANSFORM_TEX(uv, _PanosphereTexture), ddxuv, ddyuv).rgb * _PanosphereColor.rgb;
+ #else
+ panoColor = _PanosphereColor.rgb;
+ #endif
+ }
+ panosphereEmission = panoColor * _PanoBlend * panoMask * _PanoEmission;
+ albedo.rgb = lerp(albedo.rgb, panoColor, _PanoBlend * .9999999 * panoMask);
+ }
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPanosphere.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPanosphere.cginc.meta
new file mode 100644
index 00000000..012e50a6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPanosphere.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 37501ac076f3b3b48b4660659204ddf7
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiParallax.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiParallax.cginc
new file mode 100644
index 00000000..db2f9da4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiParallax.cginc
@@ -0,0 +1,166 @@
+#ifndef POI_PARALLAX
+ #define POI_PARALLAX
+
+ #if defined(PROP_PARALLAXHEIGHTMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ParallaxHeightMap); float4 _ParallaxHeightMap_ST;
+ #endif
+ #if defined(PROP_PARALLAXHEIGHTMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_ParallaxHeightMapMask);
+ #endif
+ float2 _ParallaxHeightMapPan;
+ float _ParallaxStrength;
+ float _ParallaxHeightMapEnabled;
+ float _ParallaxUV;
+
+ //Internal
+ float _ParallaxInternalMapEnabled;
+ #if defined(PROP_PARALLAXINTERNALMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ParallaxInternalMap); float4 _ParallaxInternalMap_ST;
+ #endif
+ #if defined(PROP_PARALLAXINTERNALMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_ParallaxInternalMapMask);
+ #endif
+ float _ParallaxInternalIterations;
+ float _ParallaxInternalMinDepth;
+ float _ParallaxInternalMaxDepth;
+ float _ParallaxInternalMinFade;
+ float _ParallaxInternalMaxFade;
+ float4 _ParallaxInternalMinColor;
+ float4 _ParallaxInternalMaxColor;
+ float4 _ParallaxInternalPanSpeed;
+ float4 _ParallaxInternalPanDepthSpeed;
+ float _ParallaxInternalHeightmapMode;
+ float _ParallaxInternalHeightFromAlpha;
+
+ float GetParallaxHeight(float2 uv)
+ {
+ #if defined(PROP_PARALLAXHEIGHTMAP) || !defined(OPTIMIZER_ENABLED)
+ return clamp(UNITY_SAMPLE_TEX2D_SAMPLER(_ParallaxHeightMap, _MainTex, TRANSFORM_TEX(uv, _ParallaxHeightMap) + _Time.x * _ParallaxHeightMapPan).g, 0, .99999);
+ #else
+ return 0;
+ #endif
+ }
+ /*
+ float2 ParallaxOffset(float2 viewDir)
+ {
+ float height = GetParallaxHeight();
+ height -= 0.5;
+ height *= _ParallaxStrength;
+ return viewDir * height;
+ }
+ */
+ float2 ParallaxRaymarching(float2 viewDir)
+ {
+ float2 uvOffset = 0;
+ float stepSize = 0.1;
+ float2 uvDelta = viewDir * (stepSize * _ParallaxStrength);
+
+ float stepHeight = 1;
+ float surfaceHeight = GetParallaxHeight(poiMesh.uv[_ParallaxUV]);
+
+
+ float2 prevUVOffset = uvOffset;
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ for (int i = 1; i < 10 && stepHeight > surfaceHeight; i ++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ surfaceHeight = GetParallaxHeight(poiMesh.uv[_ParallaxUV] + uvOffset);
+ }
+
+ float prevDifference = prevStepHeight - prevSurfaceHeight;
+ float difference = surfaceHeight - stepHeight;
+ float t = prevDifference / (prevDifference + difference);
+ uvOffset = prevUVOffset -uvDelta * t;
+ #if defined(PROP_PARALLAXHEIGHTMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ return uvOffset *= POI2D_SAMPLER_PAN(_ParallaxHeightMapMask, _MainTex, poiMesh.uv[_ParallaxHeightMapMaskUV], _ParallaxHeightMapMaskPan).r;
+ #else
+ return uvOffset;
+ #endif
+ }
+
+ void calculateandApplyParallax()
+ {
+ UNITY_BRANCH
+ if (_ParallaxHeightMapEnabled)
+ {
+ float2 parallaxOffset = ParallaxRaymarching(poiCam.tangentViewDir.xy);
+ UNITY_BRANCH
+ if(_ParallaxUV == 0)
+ {
+ poiMesh.uv[0] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 1)
+ {
+ poiMesh.uv[1] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 2)
+ {
+ poiMesh.uv[2] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 3)
+ {
+ poiMesh.uv[3] += parallaxOffset;
+ }
+ }
+ }
+
+ void calculateAndApplyInternalParallax(inout float4 finalColor)
+ {
+ #if defined(_PARALLAXMAP)
+ UNITY_BRANCH
+ if(_ParallaxInternalMapEnabled)
+ {
+ float3 parallax = 0;
+
+ for (int j = _ParallaxInternalIterations; j > 0; j --)
+ {
+ float ratio = (float)j / _ParallaxInternalIterations;
+ float2 parallaxOffset = _Time.y * (_ParallaxInternalPanSpeed + (1 - ratio) * _ParallaxInternalPanDepthSpeed);
+ float fade = lerp(_ParallaxInternalMinFade, _ParallaxInternalMaxFade, ratio);
+ #if defined(PROP_PARALLAXINTERNALMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 parallaxColor = UNITY_SAMPLE_TEX2D_SAMPLER(_ParallaxInternalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _ParallaxInternalMap) + lerp(_ParallaxInternalMinDepth, _ParallaxInternalMaxDepth, ratio) * - poiCam.tangentViewDir.xy + parallaxOffset);
+ #else
+ float4 parallaxColor = 0;
+ #endif
+ float3 parallaxTint = lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, ratio);
+ float parallaxHeight;
+ if(_ParallaxInternalHeightFromAlpha)
+ {
+ parallaxTint *= parallaxColor.rgb;
+ parallaxHeight = parallaxColor.a;
+ }
+ else
+ {
+ parallaxHeight = parallaxColor.r;
+ }
+ //float parallaxColor *= lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, 1 - ratio);
+ UNITY_BRANCH
+ if (_ParallaxInternalHeightmapMode == 1)
+ {
+ parallax = lerp(parallax, parallaxTint * fade, parallaxHeight >= 1 - ratio);
+ }
+ else
+ {
+ parallax += parallaxTint * parallaxHeight * fade;
+ }
+ }
+ //parallax /= _ParallaxInternalIterations;
+ #if defined(PROP_PARALLAXINTERNALMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ finalColor.rgb += parallax * POI2D_SAMPLER_PAN(_ParallaxInternalMapMask, _MainTex, poiMesh.uv[_ParallaxInternalMapMaskUV], _ParallaxInternalMapMaskPan).r;
+ #else
+ finalColor.rgb += parallax;
+ #endif
+ }
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiParallax.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiParallax.cginc.meta
new file mode 100644
index 00000000..99c340ce
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiParallax.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 932d61640027e2a4e8a418fc07545428
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPass.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPass.cginc
new file mode 100644
index 00000000..eecd5a12
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPass.cginc
@@ -0,0 +1,252 @@
+/*
+USED---------------------------------------------
+"_PARALLAXMAP"
+"_REQUIRE_UV2"
+"_SUNDISK_NONE"
+"_DETAIL_MULX2"
+"_GLOSSYREFLECTIONS_OFF"
+"_METALLICGLOSSMAP"
+"_COLORADDSUBDIFF_ON"
+"_SPECGLOSSMAP"
+"_TERRAIN_NORMAL_MAP"
+"_SUNDISK_SIMPLE"
+"_EMISSION"
+"_COLORCOLOR_ON"
+"_COLOROVERLAY_ON"
+"_ALPHAMODULATE_ON"
+"_SUNDISK_HIGH_QUALITY"
+"_MAPPING_6_FRAMES_LAYOUT"
+"_NORMALMAP
+"EFFECT_BUMP"
+"BLOOM"
+"BLOOM_LOW"
+"GRAIN"
+"DEPTH_OF_FIELD"
+"USER_LUT"
+"CHROMATIC_ABERRATION_LOW"
+"BLOOM_LENS_DIRT"
+"_FADING_ON"
+"CHROMATIC_ABERRATION"
+"DISTORT"
+"GEOM_TYPE_BRANCH"
+"_SPECULARHIGHLIGHTS_OFF"
+"_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A"
+"EFFECT_HUE_VARIATION"
+"GEOM_TYPE_LEAF"
+"GEOM_TYPE_MESH"
+"FINALPASS"
+"AUTO_EXPOSURE
+"VIGNETTE"
+"VIGNETTE_MASKED"
+"COLOR_GRADING_HDR"
+"COLOR_GRADING_HDR_3D"
+"DITHERING"
+"VIGNETTE_CLASSIC"
+"GEOM_TYPE_BRANCH_DETAIL"
+"GEOM_TYPE_FROND"
+"DEPTH_OF_FIELD_COC_VIEW"
+"COLOR_GRADING_LOG_VIEW"
+"TONEMAPPING_CUSTOM"
+
+UNUSED-------------------------------------------
+"_ALPHABLEND_ON"
+"_ALPHAPREMULTIPLY_ON"
+"_ALPHATEST_ON"
+"PIXELSNAP_ON"
+"TONEMAPPING_FILMIC"
+"TONEMAPPING_NEUTRAL"
+"TONEMAPPING_ACES"
+"COLOR_GRADING"
+
+DO NOT USE -----------------------------------------
+"BILLBOARD_FACE_CAMERA_POS"
+SOFTPARTICLES_ON
+*/
+
+
+#ifndef POI_PASS
+#define POI_PASS
+
+#include "UnityCG.cginc"
+#include "Lighting.cginc"
+#include "UnityPBSLighting.cginc"
+#include "AutoLight.cginc"
+#include "UnityShaderVariables.cginc"
+
+#ifdef POI_META_PASS
+ #include "UnityMetaPass.cginc"
+#endif
+
+//#pragma warning (default : 3206) // implicit truncation
+
+#include "CGI_PoiMacros.cginc"
+#include "CGI_PoiDefines.cginc"
+#include "CGI_FunctionsArtistic.cginc"
+
+#include "CGI_Poicludes.cginc"
+#include "CGI_PoiHelpers.cginc"
+#include "CGI_PoiBlending.cginc"
+
+#ifdef _SUNDISK_NONE
+ #include "CGI_PoiRandom.cginc"
+#endif
+
+#ifdef _REQUIRE_UV2
+ #include "CGI_PoiMirror.cginc"
+#endif
+
+#include "CGI_PoiPenetration.cginc"
+#include "CGI_PoiVertexManipulations.cginc"
+
+#include "CGI_PoiSpawnInVert.cginc"
+
+#include "CGI_PoiV2F.cginc"
+
+#ifdef BLOOM_LOW
+ #include "CGI_PoiBulge.cginc"
+#endif
+
+#include "CGI_PoiVert.cginc"
+
+#ifdef TESSELATION
+ #include "CGI_PoiTessellation.cginc"
+#endif
+
+#include "CGI_PoiDithering.cginc"
+
+#ifdef _PARALLAXMAP
+ #include "CGI_PoiParallax.cginc"
+#endif
+
+#ifdef COLOR_GRADING_LOG_VIEW
+ #include "CGI_PoiAudioLink.cginc"
+#endif
+
+#ifdef USER_LUT
+ #include "CGI_PoiUVDistortion.cginc"
+#endif
+
+#ifdef VIGNETTE
+ #include "CGI_PoiRGBMask.cginc"
+#endif
+
+#include "CGI_PoiData.cginc"
+
+#ifdef _SPECULARHIGHLIGHTS_OFF
+ #include "CGI_PoiBlackLight.cginc"
+#endif
+
+#include "CGI_PoiSpawnInFrag.cginc"
+
+#ifdef WIREFRAME
+ #include "CGI_PoiWireframe.cginc"
+#endif
+
+#ifdef DISTORT
+ #include "CGI_PoiDissolve.cginc"
+#endif
+
+#ifdef DEPTH_OF_FIELD
+ #include "CGI_PoiHologram.cginc"
+#endif
+
+#ifdef BLOOM_LENS_DIRT
+ #include "CGI_PoiIridescence.cginc"
+#endif
+
+
+#ifdef FUR
+ #include "CGI_PoiFur.cginc"
+ #include "CGI_PoiGeomFur.cginc"
+#endif
+
+#ifdef VIGNETTE_MASKED
+ #include "CGI_PoiLighting.cginc"
+#endif
+
+#include "CGI_PoiMainTex.cginc"
+
+#ifdef TONEMAPPING_CUSTOM
+ #include "CGI_PoiPathing.cginc"
+#endif
+
+#ifdef GEOM_TYPE_BRANCH
+ #include "CGI_PoiDecal.cginc"
+#endif
+
+#ifdef CHROMATIC_ABERRATION
+ #include "CGI_PoiVoronoi.cginc"
+#endif
+
+#ifdef _DETAIL_MULX2
+ #include "CGI_PoiPanosphere.cginc"
+#endif
+
+#ifdef EFFECT_BUMP
+ #include "CGI_PoiMSDF.cginc"
+#endif
+
+#ifdef GRAIN
+ #include "CGI_PoiDepthColor.cginc"
+#endif
+
+
+#ifdef _SUNDISK_HIGH_QUALITY
+ #include "CGI_PoiFlipbook.cginc"
+#endif
+
+#ifdef _GLOSSYREFLECTIONS_OFF
+ #include "CGI_PoiRimLighting.cginc"
+#endif
+
+#ifdef _MAPPING_6_FRAMES_LAYOUT
+ #include "CGI_PoiEnvironmentalRimLighting.cginc"
+#endif
+
+#ifdef VIGNETTE_CLASSIC
+ #include "CGI_PoiBRDF.cginc"
+#endif
+
+#ifdef _METALLICGLOSSMAP
+ #include "CGI_PoiMetal.cginc"
+#endif
+
+#ifdef _COLORADDSUBDIFF_ON
+ #include "CGI_PoiMatcap.cginc"
+#endif
+
+#ifdef _SPECGLOSSMAP
+ #include "CGI_PoiSpecular.cginc"
+#endif
+
+#ifdef BLOOM
+ #include "CGI_PoiVideo.cginc"
+#endif
+
+#ifdef _TERRAIN_NORMAL_MAP
+ #include "CGI_PoiSubsurfaceScattering.cginc"
+#endif
+
+#include "CGI_PoiBlending.cginc"
+#include "CGI_PoiGrab.cginc"
+
+#ifdef _SUNDISK_SIMPLE
+ #include "CGI_PoiGlitter.cginc"
+#endif
+
+#ifdef _EMISSION
+ #include "CGI_PoiEmission.cginc"
+#endif
+
+#ifdef _COLORCOLOR_ON
+ #include "CGI_PoiClearCoat.cginc"
+#endif
+
+#include "CGI_PoiAlphaToCoverage.cginc"
+
+#ifdef _COLOROVERLAY_ON
+ #include "CGI_PoiDebug.cginc"
+#endif
+#include "CGI_PoiFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPass.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPass.cginc.meta
new file mode 100644
index 00000000..10aa0b57
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPass.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 56df84a93addae540995e4c5231ce307
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassOutline.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassOutline.cginc
new file mode 100644
index 00000000..f8504d25
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassOutline.cginc
@@ -0,0 +1,34 @@
+#ifndef POI_PASS_OUTLINE
+#define POI_PASS_OUTLINE
+
+#include "UnityCG.cginc"
+#include "Lighting.cginc"
+#include "UnityPBSLighting.cginc"
+#include "AutoLight.cginc"
+#include "CGI_PoiMacros.cginc"
+#include "CGI_PoiDefines.cginc"
+#include "CGI_FunctionsArtistic.cginc"
+#include "CGI_Poicludes.cginc"
+#include "CGI_PoiHelpers.cginc"
+#include "CGI_PoiBlending.cginc"
+#include "CGI_PoiPenetration.cginc"
+#include "CGI_PoiVertexManipulations.cginc"
+#include "CGI_PoiOutlineVert.cginc"
+#ifdef TESSELATION
+ #include "CGI_PoiTessellation.cginc"
+#endif
+#ifdef _REQUIRE_UV2
+ #include "CGI_PoiMirror.cginc"
+#endif
+#ifdef DISTORT
+ #include "CGI_PoiDissolve.cginc"
+#endif
+#include "CGI_PoiLighting.cginc"
+#include "CGI_PoiMainTex.cginc"
+#include "CGI_PoiData.cginc"
+#include "CGI_PoiDithering.cginc"
+#ifdef _COLOROVERLAY_ON
+ #include "CGI_PoiDebug.cginc"
+#endif
+#include "CGI_PoiOutlineFrag.cginc"
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassOutline.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassOutline.cginc.meta
new file mode 100644
index 00000000..b7ec74c2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassOutline.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1d1278c39c5ac99439980df6a1a4ca74
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassShadow.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassShadow.cginc
new file mode 100644
index 00000000..9e5c4fea
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassShadow.cginc
@@ -0,0 +1,46 @@
+#ifndef POI_PASS_SHADOW
+ #define POI_PASS_SHADOW
+
+ #pragma multi_compile_shadowcaster
+ #include "UnityCG.cginc"
+ #include "UnityShaderVariables.cginc"
+ #include "UnityCG.cginc"
+ #include "Lighting.cginc"
+ #include "UnityPBSLighting.cginc"
+ #include "AutoLight.cginc"
+
+ #include "CGI_PoiMacros.cginc"
+ #include "CGI_PoiDefines.cginc"
+
+ #include "CGI_Poicludes.cginc"
+ #include "CGI_PoiShadowIncludes.cginc"
+ #include "CGI_PoiHelpers.cginc"
+ #include "CGI_PoiMirror.cginc"
+ #include "CGI_PoiSpawnInFrag.cginc"
+
+ #include "CGI_PoiV2F.cginc"
+ #include "CGI_PoiData.cginc"
+
+ #ifdef WIREFRAME
+ #include "CGI_PoiWireframe.cginc"
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ #include "CGI_PoiFlipbook.cginc"
+ #endif
+
+ #ifdef _SUNDISK_NONE
+ #include "CGI_PoiRandom.cginc"
+ #endif
+ #include "CGI_PoiDithering.cginc"
+ #ifdef DISTORT
+ #include "CGI_PoiDissolve.cginc"
+ #endif
+ #include "CGI_PoiPenetration.cginc"
+ #include "CGI_PoiVertexManipulations.cginc"
+
+ #include "CGI_PoiSpawnInVert.cginc"
+ #include "CGI_PoiShadowVert.cginc"
+ #include "CGI_PoiShadowFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassShadow.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassShadow.cginc.meta
new file mode 100644
index 00000000..d1e839b5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPassShadow.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4a80901232ee8944b84bd606e1969df2
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPathing.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPathing.cginc
new file mode 100644
index 00000000..b35f402e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPathing.cginc
@@ -0,0 +1,150 @@
+#ifndef POI_PATHING
+#define POI_PATHING
+
+// Fill, 0, Path, 1, Loop, 2
+half _PathTypeR;
+half _PathTypeG;
+half _PathTypeB;
+half3 _PathWidth;
+float3 _PathTime;
+float3 _PathOffset;
+float3 _PathSpeed;
+float4 _PathColorR;
+float4 _PathColorG;
+float4 _PathColorB;
+float3 _PathEmissionStrength;
+float3 _PathSoftness;
+float3 _PathSegments;
+float3 _PathAlpha;
+
+#ifdef POI_AUDIOLINK
+ // Time Offset
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+
+ // Emission Offset
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+
+ // Length Offset
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+#endif
+
+#if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_PathingMap);
+#endif
+#if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_PathingColorMap);
+#endif
+
+void applyPathing(inout float4 albedo, inout float3 pathEmission)
+{
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = POI2D_SAMPLER_PAN(_PathingMap, _MainTex, poiMesh.uv[_PathingMapUV], _PathingMapPan);
+ #else
+ float4 path = float4(0,0,0,0);
+ return;
+ #endif
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 pathColorMap = POI2D_SAMPLER_PAN(_PathingColorMap, _MainTex, poiMesh.uv[_PathingColorMapUV], _PathingColorMapPan);
+ #else
+ float4 pathColorMap = float4(1, 1, 1, 1);
+ #endif
+
+ float3 pathAudioLinkEmission = 0;
+ float3 pathTime = 0;
+ float3 pathAlpha[3] = {
+ float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0)
+ };
+
+
+ #ifdef POI_AUDIOLINK
+ half pathAudioLinkPathTimeOffsetBand[3] = {_AudioLinkPathTimeOffsetBandR, _AudioLinkPathTimeOffsetBandG, _AudioLinkPathTimeOffsetBandB};
+ half2 pathAudioLinkTimeOffset[3] = {_AudioLinkPathTimeOffsetR.xy, _AudioLinkPathTimeOffsetG.xy, _AudioLinkPathTimeOffsetB.xy};
+ half pathAudioLinkPathWidthOffsetBand[3] = {_AudioLinkPathWidthOffsetBandR, _AudioLinkPathWidthOffsetBandG, _AudioLinkPathWidthOffsetBandB};
+ half2 pathAudioLinkWidthOffset[3] = {_AudioLinkPathWidthOffsetR.xy, _AudioLinkPathWidthOffsetG.xy, _AudioLinkPathWidthOffsetB.xy};
+
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ // Emission
+ pathAudioLinkEmission.r = lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g = lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b = lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 3; index++)
+ {
+ pathTime[index] = _PathTime[index] != -999.0f ? frac(_PathTime[index] + _PathOffset[index]): frac(_Time.x * _PathSpeed[index] + _PathOffset[index]);
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ pathTime[index] += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+ #endif
+
+ 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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ #endif
+
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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]);
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * _PathColorR.rgb * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * _PathColorG.rgb * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ pathEmission += pathAlpha[2][_PathTypeB] * _PathColorB.rgb * (_PathEmissionStrength[2] + pathAudioLinkEmission.b);
+ pathEmission *= pathColorMap.rgb * pathColorMap.a * path.a;
+
+ float3 colorReplace = 0;
+ colorReplace = pathAlpha[0][_PathTypeR] * _PathColorR.rgb * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * path.a * _PathColorR.a * pathAlpha[0][_PathTypeR]);
+ colorReplace = pathAlpha[1][_PathTypeG] * _PathColorG.rgb * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * path.a * _PathColorG.a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * _PathColorB.rgb * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * path.a * _PathColorB.a * pathAlpha[2][_PathTypeB]);
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPathing.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPathing.cginc.meta
new file mode 100644
index 00000000..9b2ee2ae
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPathing.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a2bfdcb9229741045991c71d6c2de82f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPenetration.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPenetration.cginc
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPenetration.cginc
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPenetration.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPenetration.cginc.meta
new file mode 100644
index 00000000..21bbf456
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiPenetration.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 562d41ae7a4e6ef468a38bafbad1be8a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRGBMask.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRGBMask.cginc
new file mode 100644
index 00000000..7a92e7b7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRGBMask.cginc
@@ -0,0 +1,191 @@
+#ifndef POI_RGBMASK
+ #define POI_RGBMASK
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RGBMask); float4 _RGBMask_ST;
+ #endif
+ #if defined(PROP_REDTEXURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RedTexure); float4 _RedTexure_ST;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_GreenTexture); float4 _GreenTexture_ST;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_BlueTexture); float4 _BlueTexture_ST;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_AlphaTexture); float4 _AlphaTexture_ST;
+ #endif
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ POI_NORMAL_NOSAMPLER(_RgbNormalR);
+ POI_NORMAL_NOSAMPLER(_RgbNormalG);
+ POI_NORMAL_NOSAMPLER(_RgbNormalB);
+ POI_NORMAL_NOSAMPLER(_RgbNormalA);
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float2 _RGBMaskPanning;
+ float2 _RGBRedPanning;
+ float2 _RGBGreenPanning;
+ float2 _RGBBluePanning;
+ float2 _RGBAlphaPanning;
+
+ float _RGBBlendMultiplicative;
+
+ float _RGBMaskUV;
+ float _RGBRed_UV;
+ float _RGBGreen_UV;
+ float _RGBBlue_UV;
+ float _RGBAlpha_UV;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+
+ static float4 rgbMask;
+
+ void calculateRGBNormals(inout half3 mainTangentSpaceNormal)
+ {
+ #ifdef GEOM_TYPE_MESH
+ #ifndef RGB_MASK_TEXTURE
+ #define RGB_MASK_TEXTURE
+ UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiMesh.uv[_RGBMaskUV], _RGBMaskPanning);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+ #endif
+
+ UNITY_BRANCH
+ if(_RgbNormalsEnabled)
+ {
+ UNITY_BRANCH
+ if(_RGBNormalBlend == 0)
+ {
+ UNITY_BRANCH
+ if(_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiMesh.uv[_RgbNormalRUV], _RgbNormalRPan), _RgbNormalRScale);
+ mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ UNITY_BRANCH
+ if(_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiMesh.uv[_RgbNormalGUV], _RgbNormalGPan), _RgbNormalGScale);
+ mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ UNITY_BRANCH
+ if(_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiMesh.uv[_RgbNormalBUV], _RgbNormalBPan), _RgbNormalBScale);
+ mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ UNITY_BRANCH
+ if(_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiMesh.uv[_RgbNormalAUV], _RgbNormalAPan), _RgbNormalAScale);
+ mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+
+ return;
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiMesh.uv[_RgbNormalRUV], _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiMesh.uv[_RgbNormalGUV], _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiMesh.uv[_RgbNormalBUV], _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiMesh.uv[_RgbNormalAUV], _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ mainTangentSpaceNormal = BlendNormals(newNormal, mainTangentSpaceNormal);
+ return;
+ }
+ }
+ #endif
+ }
+
+ float3 calculateRGBMask(float3 baseColor)
+ {
+ //If RGB normals are in use this data will already exist
+ #ifndef RGB_MASK_TEXTURE
+ #define RGB_MASK_TEXTURE
+
+ UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiMesh.uv[_RGBMaskUV], _RGBMaskPanning);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+ #endif
+ #if defined(PROP_REDTEXURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexure, _MainTex, poiMesh.uv[_RGBRed_UV], _RGBRedPanning);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiMesh.uv[_RGBGreen_UV], _RGBGreenPanning);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiMesh.uv[_RGBBlue_UV], _RGBBluePanning);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiMesh.uv[_RGBAlpha_UV], _RGBAlphaPanning);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ UNITY_BRANCH
+ if(_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * _RedColor.rgb, rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * _GreenColor.rgb, rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * _BlueColor.rgb, rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * _AlphaColor.rgb, rgbMask.a * alpha.a * _AlphaColor.a);
+
+ baseColor *= RGBColor;
+ }
+ else
+ {
+ baseColor = lerp(baseColor, red.rgb * _RedColor.rgb, rgbMask.r * red.a * _RedColor.a);
+ baseColor = lerp(baseColor, green.rgb * _GreenColor.rgb, rgbMask.g * green.a * _GreenColor.a);
+ baseColor = lerp(baseColor, blue.rgb * _BlueColor.rgb, rgbMask.b * blue.a * _BlueColor.a);
+ baseColor = lerp(baseColor, alpha.rgb * _AlphaColor.rgb, rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+
+ return baseColor;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRGBMask.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRGBMask.cginc.meta
new file mode 100644
index 00000000..85e0b96c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRGBMask.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 17373df008bda724d88f0a5d5f96299b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRandom.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRandom.cginc
new file mode 100644
index 00000000..7870c853
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRandom.cginc
@@ -0,0 +1,41 @@
+#ifndef POI_RANDOM
+ #define POI_RANDOM
+
+ float _EnableRandom;
+ float m_start_Angle;
+ float _AngleType;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+ float _AngleCompareTo;
+
+ float ApplyAngleBasedRendering(float3 modelPos, float3 worldPos)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? modelPos : worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection)));
+ half cameraLookAtModel = remapClamped(.5 * dot(cameraToModelDirection, getCameraForward()) + .5, cameraAngleMax, cameraAngleMin, 0, 1);
+ half modelLookAtCamera = remapClamped(.5 * dot(-cameraToModelDirection, modelForwardDirection) + .5, modelAngleMax, modelAngleMin, 0, 1);
+ if (_AngleType == 0)
+ {
+ return max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if(_AngleType == 1)
+ {
+ return max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if(_AngleType == 2)
+ {
+ return max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ return 1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRandom.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRandom.cginc.meta
new file mode 100644
index 00000000..1406b664
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRandom.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 205cd9a2ee0ef7b4d81920588902780d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRimLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRimLighting.cginc
new file mode 100644
index 00000000..dd0b9fac
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRimLighting.cginc
@@ -0,0 +1,99 @@
+#ifndef POI_RIM
+#define POI_RIM
+
+float4 _RimLightColor;
+float _RimLightingInvert;
+float _RimWidth;
+float _RimStrength;
+float _RimSharpness;
+float _RimLightColorBias;
+float _ShadowMix;
+float _ShadowMixThreshold;
+float _ShadowMixWidthMod;
+float _EnableRimLighting;
+float _RimBrighten;
+float _RimLightNormal;
+float _RimHueShiftEnabled;
+float _RimHueShiftSpeed;
+float _RimHueShift;
+
+#ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+#endif
+
+#if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_RimTex);
+#endif
+#if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_RimMask);
+#endif
+#if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_RimWidthNoiseTexture);
+#endif
+
+float _RimWidthNoiseStrength;
+
+float4 rimColor = float4(0, 0, 0, 0);
+float rim = 0;
+
+void applyRimLighting(inout float4 albedo, inout float3 rimLightEmission)
+{
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+
+ float viewDotNormal = saturate(abs(dot(poiCam.viewDir, poiMesh.normals[_RimLightNormal])));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+ float rimStrength = _RimStrength;
+ float rimBrighten = _RimBrighten;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ rimStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ rimBrighten += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ rimWidth -= rimNoise;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiMesh.uv[_RimMaskUV], _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiMesh.uv[_RimTexUV], _RimTexPan) * _RimLightColor;
+ #else
+ rimColor = _RimLightColor;
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+ rimLightEmission = rim * lerp(albedo, rimColor, _RimLightColorBias) * rimStrength;
+ albedo.rgb = lerp(albedo.rgb, lerp(albedo.rgb, rimColor, _RimLightColorBias) + lerp(albedo.rgb, rimColor, _RimLightColorBias) * rimBrighten, rim);
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRimLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRimLighting.cginc.meta
new file mode 100644
index 00000000..b1c5a95d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiRimLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 2ad8e1a6a3d9e064796622a6d6741fcd
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowFrag.cginc
new file mode 100644
index 00000000..8e6499fa
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowFrag.cginc
@@ -0,0 +1,143 @@
+#ifndef SHADOW_FRAG
+#define SHADOW_FRAG
+
+float2 _MainDistanceFade;
+float _ForceOpaque;
+float _MainShadowClipMod;
+float2 _ClippingMaskPan;
+float _ClippingMaskUV;
+sampler3D _DitherMaskLOD;
+float2 _MainTexPan;
+float _MainTextureUV;
+float _Inverse_Clipping;
+float _MainDistanceFadeMin;
+float _MainDistanceFadeMax;
+half _MainMinAlpha;
+half _MainMaxAlpha;
+
+#if defined(PROP_MAINFADETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MainFadeTexture);
+#endif
+
+float distanceFade()
+{
+ #if defined(PROP_MAINFADETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ half fadeMap = POI2D_SAMPLER_PAN(_MainFadeTexture, _MainTex, poiMesh.uv[_MainFadeTextureUV], _MainFadeTexturePan).r;
+ #else
+ half fadeMap = 1;
+ #endif
+
+ return lerp(_MainMinAlpha, _MainMaxAlpha, smoothstep(_MainDistanceFadeMin, _MainDistanceFadeMax, distance(poiMesh.worldPos, poiCam.worldPos)));
+}
+
+half4 fragShadowCaster(
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ V2FShadow i, uint facing: SV_IsFrontFace
+ #endif
+ ): SV_Target
+ {
+ poiMesh.uv[0] = i.uv;
+ poiMesh.uv[1] = i.uv1;
+ poiMesh.uv[2] = i.uv2;
+ poiMesh.uv[3] = i.uv3;
+
+ // Basically every texture relies on the maintex sampler to function and that's why this is here.
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[_MainTextureUV], _MainTex) + _Time.x * _MainTexPan);
+
+
+ //Possible Bug with clip
+ float clipValue = clamp(_Cutoff + _MainShadowClipMod, - .001, 1.001);
+
+ poiMesh.vertexColor = saturate(i.vertexColor);
+ poiMesh.worldPos = i.worldPos;
+ poiMesh.localPos = i.localPos;
+ poiCam.worldPos = _WorldSpaceCameraPos;
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderFrag();
+ #endif
+
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+
+ half4 alpha = mainTexture;
+
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_BRANCH
+ if (_EnableMirrorTexture)
+ {
+ if (IsInMirror())
+ {
+ alpha.a = UNITY_SAMPLE_TEX2D_SAMPLER(_MirrorTexture, _MainTex, TRANSFORM_TEX(i.uv, _MirrorTexture)).a;
+ }
+ }
+ #endif
+
+ alpha.a *= distanceFade();
+ half alphaMask = POI2D_PAN(_ClippingMask, poiMesh.uv[_ClippingMaskUV], _ClippingMaskPan);
+ UNITY_BRANCH
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ alpha.a *= alphaMask;
+ alpha.a *= _Color.a + .0001;
+ alpha.a += _AlphaMod;
+ alpha.a = saturate(alpha.a);
+
+ UNITY_BRANCH
+ if (_Mode == 0)
+ {
+ alpha.a = 1;
+ }
+
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ applyShadowDithering(alpha.a, calcScreenUVs(i.grabPos).xy);
+ }
+
+ #ifdef POI_DISSOLVE
+ float3 fakeEmission = 1;
+ calculateDissolve(alpha, fakeEmission);
+ #endif
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ clip(alpha.a - 0.001);
+ }
+
+ /*
+ return poiMesh.vertexColor.g;
+
+ #ifdef POI_RANDOM
+ alpha.a *= i.angleAlpha;
+ #endif
+
+ UNITY_BRANCH
+ if(_Mode >= 1)
+ {
+ applySpawnInShadow(uv[0], i.localPos);
+
+ #if defined(POI_FLIPBOOK)
+ alpha.a *= applyFlipbookAlphaToShadow(uv[_FlipbookTexArrayUV]);
+ #endif
+ }
+ */
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ clip(alpha.a - clipValue);
+ }
+
+ UNITY_BRANCH
+ if (_Mode > 1)
+ {
+ float dither = tex3D(_DitherMaskLOD, float3(i.pos.xy * .25, alpha.a * 0.9375)).a;
+ clip(dither - 0.01);
+ }
+
+ #endif
+ SHADOW_CASTER_FRAGMENT(i)
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowFrag.cginc.meta
new file mode 100644
index 00000000..4c478b31
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: cbb0febb2522f6f44b504c3a9f09111b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowIncludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowIncludes.cginc
new file mode 100644
index 00000000..583b0e75
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowIncludes.cginc
@@ -0,0 +1,44 @@
+#ifndef SHADOW_INCLUDES
+ #define SHADOW_INCLUDES
+
+ #define UNITY_STANDARD_USE_SHADOW_UVS 1
+
+ float4 _Color;
+ sampler2D _ClippingMask; float4 _ClippingMask_ST;
+
+ struct VertexInputShadow
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float4 color: COLOR;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ struct V2FShadow
+ {
+ V2F_SHADOW_CASTER_NOPOS
+ float4 pos: SV_POSITION;
+ float2 uv: TEXCOORD1;
+ float2 uv1: TEXCOORD2;
+ float2 uv2: TEXCOORD3;
+ float2 uv3: TEXCOORD4;
+ float3 modelPos: TEXCOORD5;
+ float4 worldPos: TEXCOORD6;
+ float4 localPos: TEXCOORD7;
+ float3 angleAlpha: TEXCOORD8;
+ float4 grabPos: TEXCOORD9;
+ fixed3 barycentricCoordinates: TEXCOORD10;
+ float4 vertexColor: TEXCOORD11;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowIncludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowIncludes.cginc.meta
new file mode 100644
index 00000000..5ac899c8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowIncludes.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6542cb7a4b0013f4386bf485ee794359
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowVert.cginc
new file mode 100644
index 00000000..b7d8328c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowVert.cginc
@@ -0,0 +1,86 @@
+float _EnableTouchGlow;
+float _EnableBulge;
+float _VertexManipulationHeightUV;
+
+V2FShadow vertShadowCaster(VertexInputShadow v)
+{
+ V2FShadow o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicOrifaceSystem(v);
+ #endif
+ #ifdef AUTO_EXPOSURE
+ applyLocalVertexTransformation(v.normal, v.vertex);
+ #endif
+
+ UNITY_INITIALIZE_OUTPUT(V2FShadow, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ o.localPos = v.vertex;
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicPenetrationSystem(o.localPos.rgb, v.normal.rgb, v);
+ #endif
+
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ o.uv = v.uv0;
+ o.uv1 = v.uv1;
+ o.uv2 = v.uv2;
+ o.uv3 = v.uv3;
+
+
+ float2 uvToUse = 0;
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 0)
+ {
+ uvToUse = v.uv0.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 1)
+ {
+ uvToUse = v.uv1.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 2)
+ {
+ uvToUse = v.uv2.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 3)
+ {
+ uvToUse = v.uv3.xy;
+ }
+ #ifdef AUTO_EXPOSURE
+ applyWorldVertexTransformation(o.worldPos, o.localPos, v.normal, uvToUse);
+ #endif
+ applyVertexGlitching(o.worldPos, o.localPos);
+ applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy);
+ #ifdef AUTO_EXPOSURE
+ applyVertexRounding(o.worldPos, o.localPos);
+ #endif
+ o.pos = UnityObjectToClipPos(o.localPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ o.vertexColor = v.color;
+
+ UNITY_BRANCH
+ if(_EnableTouchGlow || _EnableBulge)
+ {
+ o.pos = UnityObjectToClipPos(float3(0, 0, -5));
+ o.localPos.xyz = float3(0, 0, -5);
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ }
+
+ o.angleAlpha = 1;
+ #ifdef POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+
+ o.pos = UnityClipSpaceShadowCasterPos(o.localPos, v.normal);
+ o.pos = UnityApplyLinearShadowBias(o.pos);
+
+ return o;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowVert.cginc.meta
new file mode 100644
index 00000000..a96de52a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiShadowVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: eb9f227e496f00b458d9beeddbc7f7ec
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInFrag.cginc
new file mode 100644
index 00000000..12bea5f7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInFrag.cginc
@@ -0,0 +1,58 @@
+#ifndef POI_SPAWN_IN_FRAG
+ #define POI_SPAWN_FRAG
+
+ #ifndef SPAWN_IN_VARIABLES
+ #define SPAWN_IN_VARIABLES
+
+ float3 _SpawnInGradientStart;
+ float3 _SpawnInGradientFinish;
+ fixed _SpawnInAlpha;
+ fixed _SpawnInNoiseIntensity;
+ float3 _SpawnInEmissionColor;
+ float _SpawnInEmissionOffset;
+ float _SpawnInVertOffset;
+ float _SpawnInVertOffsetOffset;
+ float _EnableScifiSpawnIn;
+ #endif
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_SpawnInNoise); float4 _SpawnInNoise_ST;
+
+ float calculateGradientValueFrag(float3 start, float3 finish, float3 localPos)
+ {
+ return inverseLerp3(start, finish, localPos);
+ }
+
+ void applySpawnIn(inout float4 finalColor, inout float3 spawnInEmission, float2 uv, float3 localPos)
+ {
+ UNITY_BRANCH
+ if (_EnableScifiSpawnIn)
+ {
+ float noise = UNITY_SAMPLE_TEX2D_SAMPLER(_SpawnInNoise, _MainTex, TRANSFORM_TEX(uv, _SpawnInNoise)).r * _SpawnInAlpha * _SpawnInNoiseIntensity;
+ float gradient = calculateGradientValueFrag(_SpawnInGradientStart, _SpawnInGradientFinish, localPos);
+ float inverseGradient = 1 - gradient;
+ float alpha = gradient - _SpawnInAlpha - noise;
+ spawnInEmission = saturate(inverseGradient + _SpawnInAlpha + _SpawnInEmissionOffset +noise - 1) * _SpawnInEmissionColor;
+ UNITY_BRANCH
+ if(_Mode >= 1)
+ {
+ clip(ceil(alpha) - 0.001);
+ }
+ }
+ }
+
+ void applySpawnInShadow(float2 uv, float3 localPos)
+ {
+ UNITY_BRANCH
+ if(_EnableScifiSpawnIn)
+ {
+ float noise = UNITY_SAMPLE_TEX2D_SAMPLER(_SpawnInNoise, _MainTex, TRANSFORM_TEX(uv, _SpawnInNoise)).r * _SpawnInAlpha * _SpawnInNoiseIntensity;
+ float gradient = calculateGradientValueFrag(_SpawnInGradientStart, _SpawnInGradientFinish, localPos);
+ float alpha = gradient - _SpawnInAlpha - noise + length(_SpawnInVertOffset);
+ UNITY_BRANCH
+ if(_Mode >= 1)
+ {
+ clip(ceil(alpha) - 0.001);
+ }
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInFrag.cginc.meta
new file mode 100644
index 00000000..d3481b04
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 58193c8c226fad945b4bfeeab2a645a6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInVert.cginc
new file mode 100644
index 00000000..01ced3fb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInVert.cginc
@@ -0,0 +1,40 @@
+#ifndef POI_SPAWN_IN_FRAG
+ #define POI_SPAWN_FRAG
+
+ #ifndef SPAWN_IN_VARIABLES
+ #define SPAWN_IN_VARIABLES
+
+ float3 _SpawnInGradientStart;
+ float3 _SpawnInGradientFinish;
+ fixed _SpawnInAlpha;
+ fixed _SpawnInNoiseIntensity;
+ float3 _SpawnInEmissionColor;
+ float _SpawnInEmissionOffset;
+ float _SpawnInVertOffset;
+ float _SpawnInVertOffsetOffset;
+ float _EnableScifiSpawnIn;
+
+ #endif
+ //sampler2D _SpawnInNoiseVert; float4 _SpawnInNoiseVert_ST;
+
+ float calculateGradientValueVert(float3 start, float3 finish, float3 localPos)
+ {
+ return inverseLerp3(start, finish, localPos);
+ }
+
+ void applySpawnInVert(inout float4 worldPos, inout float4 localPos, float2 uv)
+ {
+ UNITY_BRANCH
+ if (_EnableScifiSpawnIn)
+ {
+ float noise = 0;
+ float gradient = calculateGradientValueVert(_SpawnInGradientStart, _SpawnInGradientFinish, localPos.xyz);
+ float inverseGradient = 1 - gradient;
+ float alpha = gradient - _SpawnInAlpha - noise;
+ worldPos.xyz += saturate(inverseGradient + _SpawnInAlpha + _SpawnInVertOffsetOffset -1) * float3(0, _SpawnInVertOffset, 0);
+ localPos.xyz = mul(unity_WorldToObject, worldPos).xyz;
+ }
+ //float noise = tex2Dlod(_SpawnInNoise, float4(TRANSFORM_TEX(uv, _SpawnInNoise))).r * _SpawnInAlpha * _SpawnInNoiseIntensity;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInVert.cginc.meta
new file mode 100644
index 00000000..3ebce544
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpawnInVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 808f1d4d05947524a92f4724d739caae
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpecular.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpecular.cginc
new file mode 100644
index 00000000..e205f1bf
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpecular.cginc
@@ -0,0 +1,505 @@
+#ifndef POI_SPECULAR
+#define POI_SPECULAR
+float _SpecWhatTangent;
+float _SpecularType;
+float _SmoothnessFrom;
+POI_TEXTURE_NOSAMPLER(_SpecularMetallicMap);
+POI_TEXTURE_NOSAMPLER(_SpecularMap);
+fixed _CenterOutSpecColor;
+POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMicro);
+float _SpecularAnisoJitterMirrored;
+POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMacro);
+POI_TEXTURE_NOSAMPLER(_SpecularAnisoFakeUV);
+POI_TEXTURE_NOSAMPLER(_AnisoTangentMap);
+POI_TEXTURE_NOSAMPLER(_SpecularMask);
+float _SpecularAnisoJitterMicroMultiplier;
+float _SpecularAnisoJitterMacroMultiplier;
+float4 _SpecularTint;
+float _SpecularSmoothness;
+float _Spec1Offset;
+float _Spec1JitterStrength;
+float _Spec2Smoothness;
+float _Spec2Offset;
+float _Spec2JitterStrength;
+float _AnisoUseTangentMap;
+float _AnisoSpec1Alpha;
+float _AnisoSpec2Alpha;
+float _SpecularInvertSmoothness;
+half _SpecularMetallic;
+float _SpecularNormal;
+float _SpecularNormal1;
+float _SpecularMaxBrightness;
+// Toon
+fixed _SpecularToonStart;
+fixed _SpecularToonEnd;
+half4 _SpecularToonInnerOuter;
+
+#ifdef DITHERING
+ float _EnableSpecular1;
+ float _SpecWhatTangent1;
+ float _SpecularType1;
+ float _SmoothnessFrom1;
+ POI_TEXTURE_NOSAMPLER(_SpecularMetallicMap1);
+ POI_TEXTURE_NOSAMPLER(_SpecularMap1);
+ POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMicro1);
+ POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMacro1);
+ float _SpecularAnisoJitterMirrored1;
+ POI_TEXTURE_NOSAMPLER(_AnisoTangentMap1);
+ POI_TEXTURE_NOSAMPLER(_SpecularMask1);
+ float _SpecularAnisoJitterMicroMultiplier1;
+ float _SpecularAnisoJitterMacroMultiplier1;
+ float4 _SpecularTint1;
+ float _SpecularSmoothness1;
+ float _Spec1Offset1;
+ float _Spec1JitterStrength1;
+ float _Spec2Smoothness1;
+ float _Spec2Offset1;
+ float _Spec2JitterStrength1;
+ float _AnisoUseTangentMap1;
+ float _AnisoSpec1Alpha1;
+ float _AnisoSpec2Alpha1;
+ float _SpecularInvertSmoothness1;
+ half _SpecularMetallic1;
+ float _SpecularMaxBrightness1;
+ // Toon
+ half4 _SpecularToonInnerOuter1;
+ fixed _SpecularToonStart1;
+ fixed _SpecularToonEnd1;
+#endif
+UnityIndirect ZeroIndirect()
+{
+ UnityIndirect ind;
+ ind.diffuse = 0;
+ ind.specular = 0;
+ return ind;
+}
+
+// From unity just putting it here in case I want to mod it
+half4 poiRealisticSpecular(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness,
+float3 normal, float3 halfDir,
+UnityLight light, UnityIndirect gi)
+{
+ float perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness);
+ #define UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV 0
+
+ #if UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV
+ half shiftAmount = dot(normal, poiCam.viewDir);
+ normal = shiftAmount < 0.0f ? normal + poiCam.viewDir * (-shiftAmount + 1e-5f): normal;
+ float nv = saturate(dot(normal, poiCam.viewDir));
+ #else
+ half nv = abs(dot(normal, poiCam.viewDir));
+ #endif
+
+ float nl = saturate(dot(normal, light.dir));
+ float nh = saturate(dot(normal, halfDir));
+
+ half lv = saturate(dot(light.dir, poiCam.viewDir));
+ half lh = saturate(dot(light.dir, halfDir));
+
+ half diffuseTerm = DisneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;
+
+ float roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
+
+ roughness = max(roughness, 0.002);
+ float V = SmithJointGGXVisibilityTerm(nl, nv, roughness);
+ float D = GGXTerm(nh, roughness);
+
+ float specularTerm = V * D * UNITY_PI;
+
+ #ifdef UNITY_COLORSPACE_GAMMA
+ specularTerm = sqrt(max(1e-4h, specularTerm));
+ #endif
+
+ specularTerm = max(0, specularTerm * nl);
+ #if defined(_POI_SPECULARHIGHLIGHTS_OFF)
+ specularTerm = 0.0;
+ #endif
+
+ half surfaceReduction;
+ #ifdef UNITY_COLORSPACE_GAMMA
+ surfaceReduction = 1.0 - 0.28 * roughness * perceptualRoughness;
+ #else
+ surfaceReduction = 1.0 / (roughness * roughness + 1.0);
+ #endif
+
+ specularTerm *= any(specColor) ? 1.0: 0.0;
+
+ half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity));
+ half3 color = diffColor * (gi.diffuse + light.color * diffuseTerm)
+ + specularTerm * light.color * FresnelTerm(specColor, lh)
+ + surfaceReduction * gi.specular * FresnelLerp(specColor, grazingTerm, nv);
+
+ return half4(color, 1);
+}
+
+half3 calculateRealisticSpecular(float4 albedo, float2 uv, float4 specularTint, float specularSmoothness, float invertSmoothness, float mixAlbedoWithTint, float4 specularMap, float3 specularLight, float3 normal, float attenuation, float3 lightDirection, float nDotL, float3 halfDir)
+{
+ half oneMinusReflectivity;
+ half3 finalSpecular;
+ UnityLight unityLight;
+ unityLight.color = specularLight;
+ unityLight.dir = lightDirection;
+ unityLight.ndotl = nDotL;
+
+ UNITY_BRANCH
+ if (_SmoothnessFrom == 0)
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specularMap.rgb * specularTint.rgb, /*out*/ oneMinusReflectivity);
+ finalSpecular = poiRealisticSpecular(diffColor, specularMap.rgb, oneMinusReflectivity, specularMap.a * specularSmoothness * lerp(1, -1, invertSmoothness), normal, halfDir, unityLight, ZeroIndirect());
+ }
+ else
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specularTint.rgb, /*out*/ oneMinusReflectivity);
+ float smoothness = max(max(specularMap.r, specularMap.g), specularMap.b);
+ finalSpecular = poiRealisticSpecular(diffColor, 1, oneMinusReflectivity, smoothness * specularSmoothness * lerp(1, -1, invertSmoothness), normal, halfDir, unityLight, ZeroIndirect());
+ }
+ finalSpecular *= lerp(1, albedo.rgb, mixAlbedoWithTint);
+ return finalSpecular;
+}
+
+half3 calculateToonSpecular(float4 albedo, float2 uv, float2 specularToonInnerOuter, float specularMixAlbedoIntoTint, float smoothnessFrom, float4 specularMap, float3 specularLight, float3 normal, float3 halfDir, float attenuation)
+{
+ half3 finalSpecular = smoothstep(1 - specularToonInnerOuter.y, 1 - specularToonInnerOuter.x, dot(halfDir, normal)) * specularLight;
+ UNITY_BRANCH
+ if (smoothnessFrom == 0)
+ {
+ finalSpecular.rgb *= specularMap.rgb * lerp(1, albedo.rgb, specularMixAlbedoIntoTint);
+ finalSpecular *= specularMap.a;
+ }
+ else
+ {
+ finalSpecular *= specularMap.r * lerp(1, albedo.rgb, specularMixAlbedoIntoTint);
+ }
+ return finalSpecular;
+}
+
+float3 strandSpecular(float TdotL, float TdotV, float specPower, float nDotL)
+{
+ #ifdef FORWARD_ADD_PASS
+ nDotL *= poiLight.attenuation * poiLight.additiveShadow;
+ #endif
+ float Specular = saturate(nDotL) * pow(saturate(sqrt(1.0 - (TdotL * TdotL)) * sqrt(1.0 - (TdotV * TdotV)) - TdotL * TdotV), specPower);
+ half normalization = sqrt((specPower + 1) * ((specPower) + 1)) / (8 * pi);
+ Specular *= normalization;
+ return Specular;
+}
+
+half3 AnisotropicSpecular(
+ float specWhatTangent, float anisoUseTangentMap, float specularSmoothness, float spec2Smoothness,
+ float anisoSpec1Alpha, float anisoSpec2Alpha, float4 specularTint, float specularMixAlbedoIntoTint, float4 specularMap, float3 specularLight, float3 lightDirection, float3 halfDir, float nDotL, float jitter, float4 packedTangentMap, in float4 albedo)
+{
+ float3 tangentOrBinormal = specWhatTangent ? poiMesh.tangent: poiMesh.binormal;
+
+
+ float3 normalLocalAniso = lerp(float3(0, 0, 1), UnpackNormal(packedTangentMap), anisoUseTangentMap);
+ normalLocalAniso = BlendNormals(normalLocalAniso, poiMesh.tangentSpaceNormal);
+ //float3 normalDirection = normalize(mul(poiMesh.normals[_SpecularNormal], poiTData.tangentTransform));
+ float3 normalDirectionAniso = Unity_SafeNormalize(mul(normalLocalAniso, poiTData.tangentTransform));
+ float3 tangentDirection = mul(poiTData.tangentTransform, tangentOrBinormal).xyz;
+ float3 viewReflectDirectionAniso = reflect(-poiCam.viewDir, normalDirectionAniso); // possible bad negation
+ float3 tangentDirectionMap = mul(poiTData.tangentToWorld, float3(normalLocalAniso.rg, 0.0)).xyz;
+ tangentDirectionMap = normalize(lerp(tangentOrBinormal, tangentDirectionMap, anisoUseTangentMap));
+
+ tangentDirectionMap += _Spec1Offset +jitter;
+
+ float TdotL = dot(lightDirection, tangentDirectionMap);
+ float TdotV = dot(poiCam.viewDir, tangentDirectionMap);
+ float TdotH = dot(halfDir, tangentDirectionMap);
+ half specPower = RoughnessToSpecPower(1.0 - specularSmoothness * specularMap.a);
+ half spec2Power = RoughnessToSpecPower(1.0 - spec2Smoothness * specularMap.a);
+ half Specular = 0;
+
+ float3 spec = strandSpecular(TdotL, TdotV, specPower, nDotL) * anisoSpec1Alpha;
+ float3 spec2 = strandSpecular(TdotL, TdotV, spec2Power, nDotL) * anisoSpec2Alpha;
+
+ return max(spec, spec2) * specularMap.rgb * specularTint.a * specularLight * lerp(1, albedo.rgb, specularMixAlbedoIntoTint);
+}
+
+inline float3 toonAnisoSpecular(float specWhatTangent, float anisoUseTangentMap, float3 lightDirection, float halfDir, float4 specularMap, float nDotL, fixed gradientStart, fixed gradientEnd, float4 specColor, float4 finalColor, fixed metallic, float jitter, float mirrored, float4 packedTangentMap)
+{
+ float3 tangentOrBinormal = specWhatTangent ? poiMesh.tangent: poiMesh.binormal;
+
+ float3 normalLocalAniso = lerp(float3(0, 0, 1), UnpackNormal(packedTangentMap), anisoUseTangentMap);
+ normalLocalAniso = BlendNormals(normalLocalAniso, poiMesh.tangentSpaceNormal);
+ //float3 normalDirection = normalize(mul(poiMesh.normals[_SpecularNormal], poiTData.tangentTransform));
+ float3 normalDirectionAniso = Unity_SafeNormalize(mul(normalLocalAniso, poiTData.tangentTransform));
+ float3 tangentDirection = mul(poiTData.tangentTransform, tangentOrBinormal).xyz;
+ float3 viewReflectDirectionAniso = reflect(-poiCam.viewDir, normalDirectionAniso); // possible bad negation
+ float3 tangentDirectionMap = mul(poiTData.tangentToWorld, float3(normalLocalAniso.rg, 0.0)).xyz;
+ tangentDirectionMap = normalize(lerp(tangentOrBinormal, tangentDirectionMap, anisoUseTangentMap));
+
+ if (!mirrored)
+ {
+ tangentDirectionMap += jitter;
+ }
+
+ float TdotL = dot(lightDirection, tangentDirectionMap);
+ float TdotV = dot(poiCam.viewDir, tangentDirectionMap);
+ float TdotH = dot(halfDir, tangentDirectionMap);
+
+ float specular = saturate(sqrt(1.0 - (TdotL * TdotL)) * sqrt(1.0 - (TdotV * TdotV)) - TdotL * TdotV);
+
+ fixed smoothAlpha = specular;
+ if (mirrored)
+ {
+ smoothAlpha = max(specular - jitter, 0);
+ }
+
+ specular = smoothstep(gradientStart, gradientEnd, smoothAlpha);
+
+ /*
+ UNITY_BRANCH
+ if(_CenterOutSpecColor)
+ {
+ specularMap = POI2D_SAMPLER_PAN(_SpecularMap, _MainTex, clamp(float2(specular, specular), 0.01, .99), _SpecularMapPan);
+ }
+ */
+
+ #ifdef FORWARD_ADD_PASS
+ nDotL *= poiLight.attenuation * poiLight.additiveShadow;
+ #endif
+
+ return saturate(nDotL) * specular * poiLight.color * specColor * specularMap.rgb * lerp(1, finalColor, metallic) * specularMap.a;
+}
+
+inline float SpecularHQ(half roughness, half dotNH, half dotLH)
+{
+ roughness = saturate(roughness);
+ roughness = max((roughness * roughness), 0.002);
+ half roughnessX2 = roughness * roughness;
+
+ half denom = dotNH * dotNH * (roughnessX2 - 1.0) + 1.0f;
+ half D = roughnessX2 / (3.14159 * denom * denom);
+
+ half k = roughness / 2.0f;
+ half k2 = k * k;
+ half invK2 = 1.0f - k2;
+
+ half vis = rcp(dotLH * dotLH * invK2 + k2);
+
+ float specTerm = vis * D;
+
+ return specTerm;
+}
+
+float3 calculateNewSpecular(in float3 specularMap, uint colorFrom, in float4 albedo, in float3 specularTint, in float specularMetallic, in float specularSmoothness, in half dotNH, in half dotLH, in float3 lightColor, in float attenuation)
+{
+ float3 specColor = specularTint;
+ float metallic = specularMetallic;
+ float roughness = 1 - specularSmoothness;
+ float perceptualRoughness = roughness;
+ //float reflectInverse = DielectricSpec.a - metallic * DielectricSpec.a;
+ //float reflectivity = 1.0h - reflectInverse;
+ float3 specMapColor = lerp(specularMap, 1, colorFrom);
+ float3 specularColor = lerp(DielectricSpec.rgb * specMapColor, lerp(specularMap, albedo.rgb, colorFrom), metallic);
+ //albedo.rgb *= reflectInverse;
+ return clamp(specularColor * lightColor * attenuation * specularTint * SpecularHQ(perceptualRoughness, dotNH, dotLH), 0, lightColor * specularTint);
+}
+
+float3 calculateSpecular(in float4 albedo)
+{
+ half3 finalSpecular = 0;
+ half3 finalSpecular1 = 0;
+ float4 realisticAlbedo = albedo;
+ float4 realisticAlbedo1 = albedo;
+ float4 specularMap = POI2D_SAMPLER_PAN(_SpecularMap, _MainTex, poiMesh.uv[_SpecularMapUV], _SpecularMapPan);
+ half metallic = POI2D_SAMPLER_PAN(_SpecularMetallicMap, _MainTex, poiMesh.uv[_SpecularMetallicMapUV], _SpecularMetallicMapPan).r * _SpecularMetallic;
+ half specularMask = POI2D_SAMPLER_PAN(_SpecularMask, _MainTex, poiMesh.uv[_SpecularMaskUV], _SpecularMaskPan).r;
+ float attenuation = saturate(poiLight.nDotL);
+
+ float3 specularLightColor = poiLight.color;
+ UNITY_BRANCH
+ if (_SpecularMaxBrightness)
+ {
+ specularLightColor = clamp(poiLight.color, 0, _SpecularMaxBrightness);
+ }
+
+ #ifdef FORWARD_ADD_PASS
+ attenuation *= poiLight.attenuation * poiLight.additiveShadow;
+ #endif
+
+ #ifdef POI_LIGHTING
+ UNITY_BRANCH
+ if (_LightingMode == 0 && _LightingRampType == 1)
+ {
+ attenuation = poiLight.rampedLightMap;
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+
+ {
+ if (_SmoothnessFrom == 1)
+ {
+ specularMap.a = specularMap.r;
+ specularMap.rgb = 1;
+ }
+
+ if (_SpecularInvertSmoothness)
+ {
+ specularMap.a = 1 - specularMap.a;
+ }
+
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, metallic, _SpecularSmoothness * specularMap.a, poiLight.dotNH, poiLight.dotLH, specularLightColor, attenuation);
+ }
+
+ UNITY_BRANCH
+ if (_SpecularType == 4)
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacroUV]), _SpecularAnisoJitterMacroPan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier;
+ jitter += _Spec1Offset;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[_AnisoTangentMapUV], _AnisoTangentMapPan);
+
+ finalSpecular += toonAnisoSpecular(_SpecWhatTangent, _AnisoUseTangentMap, poiLight.direction, poiLight.halfDir, specularMap, poiLight.nDotL, _SpecularToonStart, _SpecularToonEnd, _SpecularTint, albedo, metallic, jitter, _SpecularAnisoJitterMirrored, packedTangentMap);
+ finalSpecular *= attenuation;
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if (_SpecularType == 2) // Toon
+
+ {
+ finalSpecular += calculateToonSpecular(albedo, poiMesh.uv[0], _SpecularToonInnerOuter, metallic, _SmoothnessFrom, specularMap, specularLightColor, poiMesh.normals[_SpecularNormal], poiLight.halfDir, poiLight.attenuation);
+ finalSpecular *= _SpecularTint;
+ }
+ UNITY_BRANCH
+ if (_SpecularType == 3) // anisotropic
+
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacroUV]), _SpecularAnisoJitterMacroPan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier;
+ jitter += _Spec1Offset;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[_AnisoTangentMapUV], _AnisoTangentMapPan);
+
+ finalSpecular += AnisotropicSpecular(_SpecWhatTangent, _AnisoUseTangentMap, _SpecularSmoothness, _Spec2Smoothness, _AnisoSpec1Alpha, _AnisoSpec2Alpha, _SpecularTint, metallic, specularMap, specularLightColor, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap, albedo);
+ finalSpecular *= _SpecularTint;
+ finalSpecular *= attenuation;
+ }
+ #endif
+
+ #ifdef VERTEXLIGHT_ON
+ // Non Important Lights
+ for (int index = 0; index < 4; index++)
+ {
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+
+ {
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, metallic, _SpecularSmoothness * specularMap.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]);
+ }
+ }
+ #endif
+
+ finalSpecular *= _SpecularTint.a;
+ finalSpecular = finalSpecular.rgb;
+ finalSpecular *= specularMask;
+
+ #ifdef DITHERING
+ UNITY_BRANCH
+ if (_SpecularMaxBrightness)
+ {
+ specularLightColor = clamp(poiLight.color, 0, _SpecularMaxBrightness1);
+ }
+ float4 specularMap1 = POI2D_SAMPLER_PAN(_SpecularMap1, _MainTex, poiMesh.uv[_SpecularMap1UV], _SpecularMap1Pan);
+ half specularMask1 = POI2D_SAMPLER_PAN(_SpecularMask1, _MainTex, poiMesh.uv[_SpecularMask1UV], _SpecularMask1Pan).r;
+ half metallic1 = POI2D_SAMPLER_PAN(_SpecularMetallicMap1, _MainTex, poiMesh.uv[_SpecularMetallicMap1UV], _SpecularMetallicMap1Pan).r * _SpecularMetallic1;
+ UNITY_BRANCH
+ if (_SpecularType1 == 1) // Realistic
+
+ {
+ UNITY_BRANCH
+ if (_SmoothnessFrom1 == 1)
+ {
+ specularMap1.a = specularMap1.r;
+ specularMap1.rgb = 1;
+ }
+ else
+ {
+ realisticAlbedo1.rgb = specularMap1.rgb;
+ }
+
+ UNITY_BRANCH
+ if (_SpecularInvertSmoothness1)
+ {
+ specularMap1.a = 1 - specularMap1.a;
+ }
+
+ finalSpecular1 = calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, metallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.dotNH, poiLight.dotLH, specularLightColor, attenuation);
+ }
+
+ UNITY_BRANCH
+ if (_SpecularType1 == 4)
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored1) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier1;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacro1UV]), _SpecularAnisoJitterMacro1Pan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier1;
+ jitter += _Spec1Offset1;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[_AnisoTangentMap1UV], _AnisoTangentMap1Pan);
+
+ finalSpecular1 += toonAnisoSpecular(_SpecWhatTangent1, _AnisoUseTangentMap1, poiLight.direction, poiLight.halfDir, specularMap1, poiLight.nDotL, _SpecularToonStart1, _SpecularToonEnd1, _SpecularTint1, albedo, metallic1, jitter, _SpecularAnisoJitterMirrored1, packedTangentMap);
+ finalSpecular1 *= poiLight.attenuation;
+ }
+
+ UNITY_BRANCH
+ if (_SpecularType1 == 2) // Toon
+
+ {
+ finalSpecular1 = calculateToonSpecular(albedo, poiMesh.uv[0], _SpecularToonInnerOuter1, metallic1, _SmoothnessFrom1, specularMap1, specularLightColor, poiMesh.normals[_SpecularNormal1], poiLight.halfDir, poiLight.attenuation);
+ finalSpecular1 *= _SpecularTint1;
+ }
+ UNITY_BRANCH
+ if (_SpecularType1 == 3) // anisotropic
+
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored1) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier1;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacro1UV]), _SpecularAnisoJitterMacro1Pan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier1;
+ jitter += _Spec1Offset1;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[_AnisoTangentMap1UV], _AnisoTangentMap1Pan);
+
+ finalSpecular1 = AnisotropicSpecular(_SpecWhatTangent1, _AnisoUseTangentMap1, _SpecularSmoothness1, _Spec2Smoothness1, _AnisoSpec1Alpha1, _AnisoSpec2Alpha1, _SpecularTint1, metallic1, specularMap1, specularLightColor, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap, albedo);
+ finalSpecular1 *= _SpecularTint1;
+ finalSpecular1 *= poiLight.attenuation;
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ // Non Important Lights
+ #ifdef VERTEXLIGHT_ON
+ for (int index = 0; index < 4; index++)
+ {
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+
+ {
+ finalSpecular1 += calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, metallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]);
+ }
+ }
+ #endif
+ #endif
+
+ finalSpecular1 *= _SpecularTint1.a;
+ finalSpecular1 = finalSpecular1.rgb;
+ finalSpecular1 *= specularMask1;
+
+ #endif
+
+ return finalSpecular + finalSpecular1;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpecular.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpecular.cginc.meta
new file mode 100644
index 00000000..95315580
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSpecular.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7c652173fc1c1d841a82c0b2e6bb102f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc
new file mode 100644
index 00000000..5878059b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc
@@ -0,0 +1,75 @@
+#ifndef SUBSURFACE
+ #define SUBSURFACE
+ /*
+ float _SSSThickness;
+ half4 _SSSColor;
+ float _SSSPointLightDirectionality;
+ float _SSSNormalOffset;
+ float _SSSStrength;
+ float _SSSExponent;
+ float _SSSNDotL;
+ float _SSSConstant;
+
+ #if defined(PROP_SSSTHICKNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_SSSThicknessMap);
+ #endif
+
+ half3 calculateSubsurfaceScattering(const float4 albedo)
+ {
+ #if defined(PROP_SSSTHICKNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ float thicknessMap = 1 - POI2D_SAMPLER_PAN(_SSSThicknessMap, _MainTex, poiMesh.uv[_SSSThicknessMapUV], _SSSThicknessMapPan);
+ #else
+ float thicknessMap = 1;
+ #endif
+
+ half4 translucencyColor = _SSSColor;
+ float3 lightDir = poiLight.direction;
+
+ #ifdef FORWARD_BASE_PASS
+ half tLitDot = saturate(dot((poiLight.direction + poiMesh.normals[1] * _SSSNormalOffset), -poiCam.viewDir));
+ #else
+ float3 lightDirectional = normalize(_WorldSpaceLightPos0.xyz - poiCam.worldPos);
+ lightDir = normalize(lerp(poiLight.direction, lightDirectional, _SSSPointLightDirectionality));
+ half tLitDot = saturate(dot((poiLight.direction + poiMesh.normals[1] * _SSSNormalOffset), -poiCam.viewDir));
+ #endif
+
+ tLitDot = exp2(-_SSSExponent * (1 - tLitDot)) * _SSSStrength;
+ float NDotL = abs(dot(poiLight.direction, poiMesh.normals[1]));
+ tLitDot *= lerp(1, NDotL, _SSSNDotL);
+
+ half translucencyOcclusion = lerp(1, thicknessMap, _SSSThickness);
+ half translucencyAtten = (tLitDot + _SSSConstant * (NDotL + 0.1)) * translucencyOcclusion;
+
+ return translucencyAtten * albedo.rgb * translucencyColor.rgb * poiLight.lightMap * poiLight.color;
+ }
+ */
+
+ float _SSSThicknessMod;
+ float _SSSSCale;
+ float _SSSPower;
+ float _SSSDistortion;
+ float4 _SSSColor;
+ float _EnableSSS;
+
+ #if defined(PROP_SSSTHICKNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_SSSThicknessMap);
+ #endif
+
+ float3 calculateSubsurfaceScattering()
+ {
+ #if defined(PROP_SSSTHICKNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ float SSS = 1 - POI2D_SAMPLER_PAN(_SSSThicknessMap, _MainTex, poiMesh.uv[_SSSThicknessMapUV], _SSSThicknessMapPan);
+ #else
+ float SSS = 1;
+ #endif
+ half3 vLTLight = poiLight.direction + poiMesh.normals[0] * _SSSDistortion;
+ half flTDot = pow(saturate(dot(poiCam.viewDir, -vLTLight)), _SSSPower) * _SSSSCale;
+ #ifdef FORWARD_BASE_PASS
+ half3 fLT = (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #else
+ half3 fLT = poiLight.attenuation * (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #endif
+
+ return fLT * poiLight.color * _SSSColor * poiLight.attenuation;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc.meta
new file mode 100644
index 00000000..3bf54538
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3679ca79b97515341a682ec5a2337cd8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiTessellation.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiTessellation.cginc
new file mode 100644
index 00000000..a35f940f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiTessellation.cginc
@@ -0,0 +1,117 @@
+#ifndef POI_TESSELLATION
+ #define POI_TESSELLATION
+
+ float _TessellationPhongStrength;
+ float _TessellationEdgeLength;
+ float _TessellationExtrusionAmount;
+ float _TessellationUniform;
+
+ struct TessellationControlPoint
+ {
+ float4 vertex: INTERNALTESSPOS;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float4 color: COLOR;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ };
+
+ struct TessellationFactors
+ {
+ float edge[3]: SV_TessFactor;
+ float inside: SV_InsideTessFactor;
+ };
+
+ TessellationControlPoint poiTessellationVert(appdata v)
+ {
+ TessellationControlPoint p;
+ p.vertex = v.vertex;
+ p.normal = v.normal;
+ p.tangent = v.tangent;
+ p.color = v.color;
+ p.uv0 = v.uv0;
+ p.uv1 = v.uv1;
+ p.uv2 = v.uv2;
+ p.uv3 = v.uv3;
+ return p;
+ }
+
+ float TessellationEdgeFactor(float3 p0, float3 p1)
+ {
+ #ifndef _FADING_ON
+ float edgeLength = distance(p0, p1);
+
+ float3 edgeCenter = (p0 + p1) * 0.5;
+ float viewDistance = distance(edgeCenter, _WorldSpaceCameraPos);
+
+ return edgeLength * _ScreenParams.y /
+ (_TessellationEdgeLength * viewDistance);
+ #else
+ return _TessellationUniform;
+ #endif
+ }
+
+ TessellationFactors poiPatchConst(
+ InputPatch < TessellationControlPoint, 3 > patch
+ )
+ {
+
+ TessellationFactors f;
+ float3 p0 = mul(unity_ObjectToWorld, patch[0].vertex).xyz;
+ float3 p1 = mul(unity_ObjectToWorld, patch[1].vertex).xyz;
+ float3 p2 = mul(unity_ObjectToWorld, patch[2].vertex).xyz;
+ f.edge[0] = TessellationEdgeFactor(p1, p2);
+ f.edge[1] = TessellationEdgeFactor(p2, p0);
+ f.edge[2] = TessellationEdgeFactor(p0, p1);
+ f.inside = (TessellationEdgeFactor(p1, p2) +
+ TessellationEdgeFactor(p2, p0) +
+ TessellationEdgeFactor(p0, p1)) * (1 / 3.0);
+ return f;
+ }
+
+ [UNITY_domain("tri")]
+ [UNITY_outputcontrolpoints(3)]
+ [UNITY_outputtopology("triangle_cw")]
+ [UNITY_partitioning("fractional_odd")]
+ [UNITY_patchconstantfunc("poiPatchConst")]
+ TessellationControlPoint poiHull(
+ InputPatch < TessellationControlPoint, 3 > patch,
+ uint id: SV_OutputControlPointID
+ )
+ {
+ return patch[id];
+ }
+
+ [UNITY_domain("tri")]
+ v2f poiDomain(
+ TessellationFactors factors,
+ OutputPatch < TessellationControlPoint, 3 > patch,
+ float3 barycentricCoordinates: SV_DomainLocation
+ )
+ {
+ appdata data;
+
+ #define MY_DOMAIN_PROGRAM_INTERPOLATE(fieldName) data.fieldName = patch[0].fieldName * barycentricCoordinates.x + patch[1].fieldName * barycentricCoordinates.y + patch[2].fieldName * barycentricCoordinates.z;
+
+ MY_DOMAIN_PROGRAM_INTERPOLATE(vertex)
+ float3 pp[3];
+ for (int i = 0; i < 3; ++ i)
+ {
+ pp[i] = data.vertex.xyz - patch[i].normal * (dot(data.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal));
+ }
+ data.vertex.xyz = _TessellationPhongStrength * (pp[0] * barycentricCoordinates.x + pp[1] * barycentricCoordinates.y + pp[2] * barycentricCoordinates.z) + (1.0f - _TessellationPhongStrength) * data.vertex.xyz;
+ MY_DOMAIN_PROGRAM_INTERPOLATE(normal)
+ data.vertex.xyz += data.normal.xyz * _TessellationExtrusionAmount;
+ MY_DOMAIN_PROGRAM_INTERPOLATE(tangent)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(color)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv0)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv1)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv2)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv3)
+
+ return vert(data);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiTessellation.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiTessellation.cginc.meta
new file mode 100644
index 00000000..340acd53
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiTessellation.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 39ea1c9d00c3fba41ac36d9204d7af35
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiUVDistortion.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiUVDistortion.cginc
new file mode 100644
index 00000000..9a3d5455
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiUVDistortion.cginc
@@ -0,0 +1,74 @@
+#ifndef POI_UV_DISTORTION
+#define POI_UV_DISTORTION
+
+#if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture); float4 _DistortionFlowTexture_ST;
+#endif
+#if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture1); float4 _DistortionFlowTexture1_ST;
+#endif
+#if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DistortionMask);
+#endif
+
+half _DistortionStrength;
+half _DistortionStrength1;
+half2 _DistortionSpeed;
+half2 _DistortionSpeed1;
+
+#ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+
+#endif
+
+float2 getTorusUv(float2 uv)
+{
+ // translated to hlsl from https://www.shadertoy.com/view/Md3Bz7
+ // http://web.cs.ucdavis.edu/~amenta/s12/findnorm.pdf
+ float phi = 6.28318530718f * uv.x;
+ float theta = 6.28318530718f * uv.y;
+ float3 c = cos(float3(phi, phi + 1.57079632679f, theta));
+ float2 result = float2(c.x * c.z, -c.y * c.z);
+ return result * 0.5 + 0.5;
+}
+
+float2 calculateDistortionUV(float2 uv)
+{
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture) + _Time.x * _DistortionSpeed) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #endif
+ #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector1 = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture1, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture1) + _Time.x * _DistortionSpeed1) * 2 - 1;
+ #else
+ float4 flowVector1 = 0;
+ #endif
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists && _EnableDistortionAudioLink)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, poiMods.audioLink[_DistortionStrengthAudioLinkBand]);
+ distortionStrength1 += lerp(_DistortionStrength1AudioLink.x, _DistortionStrength1AudioLink.y, poiMods.audioLink[_DistortionStrength1AudioLinkBand]);
+ }
+ #endif
+
+ flowVector *= distortionStrength;
+ flowVector1 *= distortionStrength1;
+ return uv + ((flowVector.xy + flowVector1.xy) / 2) * distortionMask;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiUVDistortion.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiUVDistortion.cginc.meta
new file mode 100644
index 00000000..49ea8148
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiUVDistortion.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 61593cffc5793c145af34dfca295bced
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiV2F.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiV2F.cginc
new file mode 100644
index 00000000..b4ab59ff
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiV2F.cginc
@@ -0,0 +1,35 @@
+#ifndef POI_V2F
+ #define POI_V2F
+
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ float4 uv0: TEXCOORD0;
+ float4 uv1: TEXCOORD1;
+ float3 normal: TEXCOORD2;
+ float3 tangentViewDir: TEXCOORD3;
+ float4 tangent: TEXCOORD4;
+ float4 binormal: TEXCOORD5;
+ float4 worldPos: TEXCOORD6;
+ float4 localPos: TEXCOORD7;
+ float4 grabPos: TEXCOORD8;
+ float3 barycentricCoordinates: TEXCOORD9;
+ #if defined(GRAIN)
+ float4 worldDirection: TEXCOORD10;
+ #endif
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ float4 lightmapUV: TEXCOORD11;
+ #endif
+ float3 modelPos: TEXCOORD12;
+ float angleAlpha: TEXCOORD13;
+ float4 vertexColor: TEXCOORD14;
+ #ifdef FUR
+ float furAlpha: TEXCOORD15;
+ #endif
+ UNITY_SHADOW_COORDS(16)
+ UNITY_FOG_COORDS(17)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiV2F.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiV2F.cginc.meta
new file mode 100644
index 00000000..6b23ce5f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiV2F.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ed99cf89d59c8c74ebac6e93e6faf84d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVert.cginc
new file mode 100644
index 00000000..63cde28b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVert.cginc
@@ -0,0 +1,145 @@
+#ifndef POI_VERT
+#define POI_VERT
+
+float _VertexManipulationHeightUV;
+float _VertexUnwrap;
+
+#define PM UNITY_MATRIX_P
+
+inline float4 CalculateFrustumCorrection()
+{
+ float x1 = -PM._31 / (PM._11 * PM._34);
+ float x2 = -PM._32 / (PM._22 * PM._34);
+ return float4(x1, x2, 0, PM._33 / PM._34 + x1 * PM._13 + x2 * PM._23);
+}
+
+float3 CreateBinormal(half3 normal, half3 tangent, half tangentSign)
+{
+ half sign = tangentSign * unity_WorldTransformParams.w;
+ return cross(normal, tangent) * sign;
+}
+
+v2f vert(appdata v)
+{
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+
+ #ifdef _COLOROVERLAY_ON
+ v.vertex.xyz = lerp(v.vertex.xyz, float3(v.uv0.x - .5, v.uv0.y - .5, 0), _VertexUnwrap);
+ #endif
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicOrifaceSystem(v);
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ applyLocalVertexTransformation(v.normal, v.tangent, v.vertex);
+ #endif
+
+
+ UNITY_INITIALIZE_OUTPUT(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+
+ #ifdef _REQUIRE_UV2 //POI_MIRROR
+ applyMirrorRenderVert(v.vertex);
+ #endif
+
+ TANGENT_SPACE_ROTATION;
+ o.localPos = v.vertex;
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicPenetrationSystem(o.localPos.rgb, o.normal.rgb, v);
+ #endif
+
+ //o.localPos.x *= -1;
+ //o.localPos.xz += sin(o.localPos.y * 100 + _Time.y * 5) * .0025;
+
+ float2 uvToUse = 0;
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 0)
+ {
+ uvToUse = v.uv0.xy;
+ }
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 1)
+ {
+ uvToUse = v.uv1.xy;
+ }
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 2)
+ {
+ uvToUse = v.uv2.xy;
+ }
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 3)
+ {
+ uvToUse = v.uv3.xy;
+ }
+ #ifdef AUTO_EXPOSURE
+ applyWorldVertexTransformation(o.worldPos, o.localPos, o.normal, uvToUse);
+ #endif
+ applyVertexGlitching(o.worldPos, o.localPos);
+ applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy);
+ #ifdef AUTO_EXPOSURE
+ applyVertexRounding(o.worldPos, o.localPos);
+ #endif
+ o.pos = UnityObjectToClipPos(o.localPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.uv0.xy = v.uv0.xy;
+ o.uv0.zw = v.uv1.xy;
+ o.uv1.xy = v.uv2.xy;
+ o.uv1.zw = v.uv3.xy;
+ o.vertexColor = v.color;
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
+
+ o.binormal.rgb = CreateBinormal(o.normal.xyz, o.tangent.xyz, o.tangent.w);
+
+ #ifdef POI_BULGE
+ bulgyWolgy(o);
+ #endif
+
+
+ o.angleAlpha = 1;
+ #ifdef _SUNDISK_NONE //POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+ #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
+
+ UNITY_TRANSFER_SHADOW(o, o.uv0.xy);
+ UNITY_TRANSFER_FOG(o, o.pos);
+
+ v.tangent.xyz = normalize(v.tangent.xyz);
+ v.normal = normalize(v.normal);
+ float3x3 objectToTangent = float3x3(
+ v.tangent.xyz,
+ cross(v.normal, v.tangent.xyz) * v.tangent.w,
+ v.normal
+ );
+ o.tangentViewDir = mul(objectToTangent, ObjSpaceViewDir(v.vertex));
+
+ #ifdef POI_META_PASS
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+
+ return o;
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVert.cginc.meta
new file mode 100644
index 00000000..fac5e8f6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 321369dd9a55f4e40a4a5cbfaf963df7
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVertexManipulations.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVertexManipulations.cginc
new file mode 100644
index 00000000..cf586808
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVertexManipulations.cginc
@@ -0,0 +1,102 @@
+#ifndef POI_VERTEX_MANIPULATION
+ #define POI_VERTEX_MANIPULATION
+
+ #include "CGI_PoiMath.cginc"
+
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+
+ float _VertexManipulationHeight;
+ float _VertexManipulationHeightBias;
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ sampler2D _VertexManipulationHeightMask; float4 _VertexManipulationHeightMask_ST;
+ #endif
+ float2 _VertexManipulationHeightPan;
+
+
+ //Vertex Glitching
+ float _EnableVertexGlitch;
+ float _VertexGlitchThreshold;
+ float _VertexGlitchFrequency;
+ float _VertexGlitchStrength;
+ // Rounding
+ float _VertexRoundingDivision;
+ float _VertexRoundingEnabled;
+
+ void applyLocalVertexTransformation(inout float3 normal, inout float4 tangent, inout float4 vertex)
+ {
+ normal = rotate_with_quaternion(normal, _VertexManipulationLocalRotation.xyz);
+ tangent.xyz = rotate_with_quaternion(tangent.xyz, _VertexManipulationLocalRotation.xyz);
+ vertex = transform(vertex, _VertexManipulationLocalTranslation, _VertexManipulationLocalRotation, _VertexManipulationLocalScale);
+
+ //vertex = float4(vertex.x + sin(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), vertex.y, vertex.z + cos(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), 1);
+ }
+
+ void applyLocalVertexTransformation(inout float3 normal, inout float4 vertex)
+ {
+ normal = rotate_with_quaternion(normal, _VertexManipulationLocalRotation.xyz);
+ vertex = transform(vertex, _VertexManipulationLocalTranslation, _VertexManipulationLocalRotation, _VertexManipulationLocalScale);
+
+ //vertex = float4(vertex.x + sin(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), vertex.y, vertex.z + cos(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), 1);
+ }
+
+ void applyWorldVertexTransformation(inout float4 worldPos, inout float4 localPos, inout float3 worldNormal, float2 uv)
+ {
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(TRANSFORM_TEX(uv, _VertexManipulationHeightMask) + _VertexManipulationHeightPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * _VertexManipulationHeight * worldNormal;
+ #else
+ float3 heightOffset = _VertexManipulationHeight * worldNormal;
+ #endif
+ worldPos.rgb += _VertexManipulationWorldTranslation.xyz/* * _VertexManipulationWorldTranslation.w*/ + heightOffset;
+ localPos.xyz = mul(unity_WorldToObject, worldPos).xyz;
+ }
+
+ void applyWorldVertexTransformationShadow(inout float4 worldPos, inout float4 localPos, float3 worldNormal, float2 uv)
+ {
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(TRANSFORM_TEX(uv, _VertexManipulationHeightMask) + _VertexManipulationHeightPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * _VertexManipulationHeight * worldNormal;
+ #else
+ float3 heightOffset = _VertexManipulationHeight * worldNormal;
+ #endif
+ worldPos.rgb += _VertexManipulationWorldTranslation.xyz/* * _VertexManipulationWorldTranslation.w*/ + heightOffset;
+ localPos.xyz = mul(unity_WorldToObject, worldPos).xyz;
+ }
+
+ void applyVertexRounding(inout float4 worldPos, inout float4 localPos)
+ {
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ worldPos.xyz = (ceil(worldPos.xyz * _VertexRoundingDivision) / _VertexRoundingDivision) - 1 / _VertexRoundingDivision * .5;
+ localPos = mul(unity_WorldToObject, worldPos);
+ }
+ }
+
+ void applyVertexGlitching(inout float4 worldPos, inout float4 localPos)
+ {
+ UNITY_BRANCH
+ if(_EnableVertexGlitch)
+ {
+ float3 forward = getCameraPosition() - mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ forward.y = 0;
+ forward = normalize(forward);
+ float3 glitchDirection = normalize(cross(float3(0, 1, 0), forward));
+ float glitchAmount = frac(sin(dot(_Time.xy + worldPos.y, float2(12.9898, 78.233))) * 43758.5453123) * 2 - 1;
+ /*
+ float uvl = worldPos.y * _VertexGlitchDensity + _Time.x * _VertexGlitchMapPanSpeed;
+ float uvr = worldPos.y * _VertexGlitchDensity - _Time.x * _VertexGlitchMapPanSpeed;
+ float glitchAmountLeft = tex2Dlod(_VertexGlitchMap, float4(uvl, uvl, 0, 0)).r;
+ float glitchAmountRight = -tex2Dlod(_VertexGlitchMap, float4(uvr, uvr, 0, 0)).r;
+ float glitchAmount = glitchAmountLeft + glitchAmountRight;
+ */
+ 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;
+ worldPos.xyz += glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * step(_VertexGlitchThreshold, randomGlitch);
+ localPos = mul(unity_WorldToObject, worldPos);
+ }
+ }
+
+#endif
+// \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVertexManipulations.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVertexManipulations.cginc.meta
new file mode 100644
index 00000000..54fea52d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVertexManipulations.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: fb0e0664f15b7ee44b7e0ce48a459cd3
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVideo.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVideo.cginc
new file mode 100644
index 00000000..2e4625e1
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVideo.cginc
@@ -0,0 +1,297 @@
+#ifndef POI_VIDEO
+ #define POI_VIDEO
+
+ #if defined(PROP_VIDEOPIXELTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoPixelTexture); float4 _VideoPixelTexture_ST;
+ #endif
+ #if defined(PROP_VIDEOMASKTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoMaskTexture); float4 _VideoMaskTexture_ST;
+ #endif
+ #if defined(PROP_VIDEOGAMEBOYRAMP) || !defined(OPTIMIZER_ENABLED)
+ sampler2D _VideoGameboyRamp;
+ #endif
+ #if defined(PROP_VIDEODEBUGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoDebugTexture); float4 _VideoDebugTexture_ST;
+ #endif
+
+ float _VideoUVNumber;
+ float _VideoType;
+ float3 pixels;
+ float2 _VideoResolution;
+ half _VideoBacklight;
+ half _VideoCRTRefreshRate;
+ half _VideoCRTPixelEnergizedTime;
+ half _VideoEnableVideoPlayer;
+ half _VideoRepeatVideoTexture;
+ half _VideoPixelateToResolution;
+ float2 _VideoMaskPanning;
+ float _VideoEmissionEnabled;
+ // Video Settings
+ half _VideoSaturation;
+ half _VideoContrast;
+ float2 _VideoTiling;
+ float2 _VideoOffset;
+ float2 _VideoPanning;
+
+ //Debug
+ half _VideoEnableDebug;
+
+
+
+ sampler2D _VRChat_VideoPlayer;
+ float4 _VRChat_VideoPlayer_TexelSize;
+
+ float4 globalVideoPlayerColor;
+ float3 globalColorToDisplayOnScreen;
+ float globalVideoOn;
+
+ float3 applyBacklight(float3 albedo, half backlightStrength)
+ {
+ return max(backlightStrength, albedo.rgb);
+ }
+
+ float3 applyViewAngleTN(float3 albedo)
+ {
+ float3 reflectionVector = normalize(reflect(poiCam.viewDir.rgb, poiMesh.normals[1].rgb));
+ float upwardShift = dot(reflectionVector, poiMesh.binormal);
+ upwardShift = pow(upwardShift, 1);
+ float sideShift = dot(reflectionVector, poiMesh.tangent);
+ sideShift *= pow(sideShift, 3);
+ #if !UNITY_COLORSPACE_GAMMA
+ albedo = LinearToGammaSpace(albedo);
+ #endif
+ albedo = saturate(lerp(half3(0.5, 0.5, 0.5), albedo, upwardShift + 1));
+ #if !UNITY_COLORSPACE_GAMMA
+ albedo = GammaToLinearSpace(albedo);
+ #endif
+ albedo = (lerp(albedo, albedo.gbr, sideShift));
+ return albedo;
+ }
+
+ float calculateCRTPixelBrightness()
+ {
+ float totalPixels = _VideoResolution.x * _VideoResolution.y;
+ float2 uvPixel = float2((floor((1 - poiMesh.uv[_VideoUVNumber].y) * _VideoResolution.y)) / _VideoResolution.y, (floor(poiMesh.uv[_VideoUVNumber].x * _VideoResolution.x)) / _VideoResolution.x);
+ float currentPixelNumber = _VideoResolution.x * (_VideoResolution.y * uvPixel.x) + _VideoResolution.y * uvPixel.y;
+ float currentPixelAlpha = currentPixelNumber / totalPixels;
+ half electronBeamAlpha = frac(_Time.y * _VideoCRTRefreshRate);
+ float electronBeamPixelNumber = totalPixels * electronBeamAlpha;
+
+ float DistanceInPixelsFromCurrentElectronBeamPixel = 0;
+ if (electronBeamPixelNumber >= currentPixelNumber)
+ {
+ DistanceInPixelsFromCurrentElectronBeamPixel = electronBeamPixelNumber - currentPixelNumber;
+ }
+ else
+ {
+ DistanceInPixelsFromCurrentElectronBeamPixel = electronBeamPixelNumber + (totalPixels - currentPixelNumber);
+ }
+ float CRTFrameTime = 1 / _VideoCRTRefreshRate;
+ float timeSincecurrentPixelWasHitByElectronBeam = (DistanceInPixelsFromCurrentElectronBeamPixel / totalPixels);
+
+ return saturate(_VideoCRTPixelEnergizedTime - timeSincecurrentPixelWasHitByElectronBeam);
+ }
+
+ void applyContrastSettings(inout float3 pixel)
+ {
+ #if !UNITY_COLORSPACE_GAMMA
+ pixel = LinearToGammaSpace(pixel);
+ #endif
+ pixel = saturate(lerp(half3(0.5, 0.5, 0.5), pixel, _VideoContrast + 1));
+ #if !UNITY_COLORSPACE_GAMMA
+ 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 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01);
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ albedo.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight + albedo * .000001;
+ }
+ void calculateTN(inout float4 albedo)
+ {
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01);
+ globalColorToDisplayOnScreen = applyViewAngleTN(globalColorToDisplayOnScreen);
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ albedo.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight + albedo * .000001;
+ }
+ void calculateCRT(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ float brightness = calculateCRTPixelBrightness();
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ albedo.rgb = globalColorToDisplayOnScreen * pixels * brightness * _VideoBacklight + albedo * .000001;
+ }
+ void calculateOLED(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ albedo.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight + albedo * .000001;
+ }
+ void calculateGameboy(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ half brightness = saturate((globalColorToDisplayOnScreen.r + globalColorToDisplayOnScreen.g + globalColorToDisplayOnScreen.b) * .3333333);
+ #if defined(PROP_VIDEOGAMEBOYRAMP) || !defined(OPTIMIZER_ENABLED)
+ albedo.rgb = tex2D(_VideoGameboyRamp, brightness);
+ #endif
+ }
+ void calculateProjector(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+
+ float3 projectorColor = albedo * globalColorToDisplayOnScreen * _VideoBacklight;
+ albedo.r = clamp(projectorColor.r, albedo.r, 1000);
+ albedo.g = clamp(projectorColor.g, albedo.g, 1000);
+ albedo.b = clamp(projectorColor.b, albedo.b, 1000);
+ }
+
+ void applyScreenEffect(inout float4 albedo, inout float3 videoEmission)
+ {
+ float4 albedoBeforeScreen = albedo;
+ #if defined(PROP_VIDEOPIXELTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ pixels = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoPixelTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoPixelTexture) * _VideoResolution);
+ #else
+ pixels = 1;
+ #endif
+ globalVideoOn = 0;
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 1)
+ {
+ float4 videoTexture = 0;
+ UNITY_BRANCH
+ if(_VideoPixelateToResolution)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableDebug)
+ {
+ #if defined(PROP_VIDEODEBUGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ videoTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoDebugTexture, _MainTex, round(TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoDebugTexture) * _VideoResolution + .5) / _VideoResolution);
+ #else
+ videoTexture = 1;
+ #endif
+ }
+ else
+ {
+ videoTexture = tex2D(_VRChat_VideoPlayer, round(poiMesh.uv[_VideoUVNumber] * _VideoResolution + .5) / _VideoResolution);
+ }
+ }
+ else
+ {
+ UNITY_BRANCH
+ if(_VideoEnableDebug)
+ {
+ #if defined(PROP_VIDEODEBUGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ videoTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoDebugTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoDebugTexture) * _VideoTiling + _VideoOffset);
+ #else
+ videoTexture = 1;
+ #endif
+ }
+ else
+ {
+ videoTexture = tex2D(_VRChat_VideoPlayer, ((poiMesh.uv[_VideoUVNumber] + _Time.x * _VideoPanning) * _VideoTiling) + _VideoOffset);
+ }
+ }
+ if(videoTexture.a == 1)
+ {
+ globalColorToDisplayOnScreen = videoTexture.rgb;
+ globalVideoOn = 1;
+ }
+ }
+
+ UNITY_BRANCH
+ if(_VideoRepeatVideoTexture == 1)
+ {
+ if(poiMesh.uv[_VideoUVNumber].x > 1 || poiMesh.uv[_VideoUVNumber].x < 0 || poiMesh.uv[_VideoUVNumber].y > 1 || poiMesh.uv[_VideoUVNumber].y < 0)
+ {
+ return;
+ }
+ }
+
+ switch(_VideoType)
+ {
+ case 0: // LCD
+ {
+ calculateLCD(albedo);
+ break;
+ }
+ case 1: // TN
+ {
+ calculateTN(albedo);
+ break;
+ }
+ case 2: // CRT
+ {
+ calculateCRT(albedo);
+ break;
+ }
+ case 3: // OLED
+ {
+ calculateOLED(albedo);
+ break;
+ }
+ case 4: // Gameboy
+ {
+ calculateGameboy(albedo);
+ break;
+ }
+ case 5: // Projector
+ {
+ calculateProjector(albedo);
+ break;
+ }
+ }
+ #if defined(PROP_VIDEOMASKTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float screenMask = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoMaskTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoMaskTexture) + _Time.x * _VideoMaskPanning);
+ #else
+ float screenMask = 1;
+ #endif
+
+ albedo = lerp(albedoBeforeScreen, albedo, screenMask);
+ UNITY_BRANCH
+ if (_VideoEmissionEnabled)
+ {
+ videoEmission = albedo.rgb * screenMask;
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVideo.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVideo.cginc.meta
new file mode 100644
index 00000000..85b15ae7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVideo.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 84cfeb89b3a44ea4bb5c832e3f9ef0fc
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVoronoi.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVoronoi.cginc
new file mode 100644
index 00000000..92cb1a5a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVoronoi.cginc
@@ -0,0 +1,312 @@
+#ifndef POI_VORONOI
+ #define POI_VORONOI
+
+ float _VoronoiSpace;
+ float _VoronoiBlend;
+ float _VoronoiType;
+ float4 _VoronoiColor0;
+ float _VoronoiEmission0;
+ float4 _VoronoiColor1;
+ float _VoronoiEmission1;
+ float2 _VoronoiGradient;
+ float _VoronoiScale;
+ float3 _VoronoiSpeed;
+ float _VoronoiEnableRandomCellColor;
+ float2 _VoronoiRandomMinMaxSaturation;
+ float2 _VoronoiRandomMinMaxBrightness;
+ float3 randomPoint;
+ float _VoronoiEffectsMaterialAlpha;
+
+ #if defined(PROP_VORONOIMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_VoronoiMask);
+ #endif
+ #if defined(PROP_VORONOINOISE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_VoronoiNoise);
+ #endif
+ float _VoronoiNoiseIntensity;
+
+ float2 inoise(float3 P, float jitter)
+ {
+ float3 Pi = mod(floor(P), 289.0);
+ float3 Pf = frac(P);
+ float3 oi = float3(-1.0, 0.0, 1.0);
+ float3 of = float3(-0.5, 0.5, 1.5);
+ float3 px = Permutation(Pi.x + oi);
+ float3 py = Permutation(Pi.y + oi);
+
+ float3 p, ox, oy, oz, dx, dy, dz;
+ float2 F = 1e6;
+
+ for (int i = 0; i < 3; i ++)
+ {
+ for (int j = 0; j < 3; j ++)
+ {
+ p = Permutation(px[i] + py[j] + Pi.z + oi); // pij1, pij2, pij3
+
+ ox = frac(p * K) - Ko;
+ oy = mod(floor(p * K), 7.0) * K - Ko;
+
+ p = Permutation(p);
+
+ oz = frac(p * K) - Ko;
+
+ dx = Pf.x - of[i] + jitter * ox;
+ dy = Pf.y - of[j] + jitter * oy;
+ dz = Pf.z - of + 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 ++)
+ {
+ if (d[n] < F[0])
+ {
+ F[1] = F[0];
+ F[0] = d[n];
+ randomPoint = p;
+ }
+ else if(d[n] < F[1])
+ {
+ F[1] = d[n];
+ }
+ }
+ }
+ }
+
+ return F;
+ }
+
+ float voronoi2D(in float2 x, float scale, float2 speed)
+ {
+ 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;
+ for (int j = -1; j <= 1; j ++)
+ {
+ for (int i = -1; i <= 1; i ++)
+ {
+ 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;
+ mr = r;
+ mg = g;
+ randomPoint.xy = currentPoint;
+ }
+ }
+ }
+
+ // second pass: distance to borders
+ md = 8.0;
+ for (int r = -2; r <= 2; r ++)
+ {
+ for (int q = -2; q <= 2; q ++)
+ {
+ 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)));
+ }
+ }
+ }
+ return md;
+ }
+
+ float voronoi3D(in float3 x, float scale, float3 speed)
+ {
+ 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;
+ for (int j = -1; j <= 1; j ++)
+ {
+ for (int i = -1; i <= 1; i ++)
+ {
+ for (int h = -1; h <= 1; h ++)
+ {
+ 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;
+ mr = r;
+ mg = g;
+ randomPoint = currentPoint;
+ }
+ }
+ }
+ }
+
+ // second pass: distance to borders
+ md = 8.0;
+ for (int r = -2; r <= 2; r ++)
+ {
+ for (int q = -2; q <= 2; q ++)
+ {
+ for (int p = -2; p <= 2; p ++)
+ {
+ 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)));
+ }
+ }
+ }
+ }
+ 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)
+ {
+ float freq = scale;
+ float weight = 1.0f;
+ float sum = 0;
+ for (int i = 0; i < octaveNumber; i ++)
+ {
+ float2 F = inoise(p * freq + time * speed, jitter) * 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)
+ {
+ float freq = scale;
+ float weight = 1.0f;
+ float sum = 0;
+ for (int i = 0; i < octaveNumber; i ++)
+ {
+ float2 F = inoise(p * freq + time * speed, jitter) * weight;
+
+ sum += sqrt(F[1]) - sqrt(F[0]);
+
+ freq *= octaveScale;
+ weight *= 1.0f - octaveAttenuation;
+ }
+ return sum;
+ }
+
+ void applyVoronoi(inout float4 finalColor, inout float3 VoronoiEmission)
+ {
+ float voronoiOctaveNumber = 1;
+ float voronoiOctaveScale = 1;
+ float voronoiOctaveAttenuation = 1;
+ randomPoint = 0;
+ float4 voronoiColor1 = _VoronoiColor1;
+
+ float voronoi = 0;
+
+ float3 position = 0;
+
+ UNITY_BRANCH
+ if (_VoronoiSpace == 0)
+ {
+ position = poiMesh.localPos;
+ }
+ UNITY_BRANCH
+ if(_VoronoiSpace == 1)
+ {
+ position = poiMesh.worldPos;
+ }
+ UNITY_BRANCH
+ if(_VoronoiSpace == 2)
+ {
+ position = float3(poiMesh.uv[0].x, poiMesh.uv[0].y, 0);
+ }
+ #if defined(PROP_VORONOIMASK) || !defined(OPTIMIZER_ENABLED)
+ float mask = POI2D_SAMPLER_PAN(_VoronoiMask, _MainTex, poiMesh.uv[_VoronoiMaskUV], _VoronoiMaskPan).r;
+ #else
+ float mask = 1;
+ #endif
+ #if defined(PROP_VORONOINOISE) || !defined(OPTIMIZER_ENABLED)
+ float edgeNoise = POI2D_SAMPLER_PAN(_VoronoiNoise, _MainTex, poiMesh.uv[_VoronoiNoiseUV], _VoronoiNoisePan).r * _VoronoiNoiseIntensity;
+ #else
+ float edgeNoise = 0;
+ #endif
+ UNITY_BRANCH
+ if(_VoronoiType == 0) // Basic
+ {
+ voronoi = voronoi2D(position.xy, _VoronoiScale, _VoronoiSpeed);
+ }
+ UNITY_BRANCH
+ if (_VoronoiType == 1) // Diff
+ {
+ voronoi = VoronoiNoiseDiff_Octaves(position, _VoronoiScale, _VoronoiSpeed, voronoiOctaveNumber, voronoiOctaveScale, voronoiOctaveAttenuation, 1, _Time.x);
+ }
+ UNITY_BRANCH
+ if (_VoronoiType == 2) // Fixed Border
+ {
+ voronoi = voronoi3D(position, _VoronoiScale, _VoronoiSpeed);
+ // isolines
+ //color = c.x * (0.5 + 0.5 * sin(64.0 * c.x)) * 1.0;
+ }
+
+ if (_VoronoiEnableRandomCellColor == 1)
+ {
+ float3 rando = random3(randomPoint);
+ fixed hue = rando.x;
+ fixed saturation = lerp(_VoronoiRandomMinMaxSaturation.x, _VoronoiRandomMinMaxSaturation.y, rando.y);
+ fixed value = lerp(_VoronoiRandomMinMaxBrightness.x, _VoronoiRandomMinMaxBrightness.y, rando.z);
+ float3 hsv = float3(hue, saturation, value);
+
+ voronoiColor1.rgb = HSVtoRGB(hsv);
+ }
+
+ float2 voronoiGradient = _VoronoiGradient;
+ voronoiGradient.xy += edgeNoise;
+ float ramp = smoothstep(voronoiGradient.x, voronoiGradient.y, voronoi);
+
+ UNITY_BRANCH
+ if(_VoronoiBlend == 0)
+ {
+ float4 voronoiColor = lerp(_VoronoiColor0, voronoiColor1, ramp);
+ UNITY_BRANCH
+ if(_VoronoiEffectsMaterialAlpha)
+ {
+ finalColor.rgba = lerp(finalColor, voronoiColor, min(mask, 0.99999));
+ }
+ else
+ {
+ finalColor.rgb = lerp(finalColor.rgb, voronoiColor.rgb, min(mask * voronoiColor.a, 0.99999));
+ }
+ }
+ float4 voronoiEmissionColor = lerp(_VoronoiColor0 * _VoronoiEmission0, voronoiColor1 * _VoronoiEmission1, ramp);
+ VoronoiEmission = voronoiEmissionColor.rgb * mask * voronoiEmissionColor.a;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVoronoi.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVoronoi.cginc.meta
new file mode 100644
index 00000000..e297cf96
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiVoronoi.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f3124be1e73e48749ba2eaaaa01aeb8c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiWireframe.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiWireframe.cginc
new file mode 100644
index 00000000..1f56e6e6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiWireframe.cginc
@@ -0,0 +1,111 @@
+#ifndef POI_WIREFRAME
+ #define POI_WIREFRAME
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_WireframeTexture); float4 _WireframeTexture_ST;
+ float2 _WireframeTexturePan;
+ float _WireframeSmoothing;
+ float _WireframeThickness;
+ float4 _WireframeColor;
+ float _WireframeAlpha;
+ float _WireframeEnable;
+ float _WireframeWaveEnabled;
+ float _WireframeWaveDensity;
+ float _WireframeWaveSpeed;
+ float _WireframeEdgeOpacity;
+ float _WireframeFaceOpacity;
+ half _WireframeEmissionAlpha;
+ float _WireframeEmissionStrength;
+ float _WireframeQuad;
+ float _WireframeUV;
+
+ #ifndef POI_SHADOW
+ void applyWireframe(inout float3 wireframeEmission, inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if (_WireframeEnable)
+ {
+ float4 colorMap = UNITY_SAMPLE_TEX2D_SAMPLER(_WireframeTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_WireframeUV], _WireframeTexture) + _Time.x * _WireframeTexturePan);
+ float size = _WireframeThickness;
+ half3 width = abs(ddx(poiMesh.barycentricCoordinates)) + abs(ddy(poiMesh.barycentricCoordinates));
+ half3 eF = smoothstep(0, width * size, poiMesh.barycentricCoordinates);
+ half minBary = size > 0 ? min(min(eF.x, eF.y), eF.z): 1;
+
+ float4 wireframeColor = _WireframeColor * colorMap;
+
+ albedo.a *= lerp(_WireframeEdgeOpacity, _WireframeFaceOpacity, minBary);
+ albedo.rgb = lerp(lerp(albedo.rgb, wireframeColor.rgb, wireframeColor.a), albedo.rgb, minBary);
+ wireframeEmission = wireframeColor.rgb * _WireframeEmissionStrength * (1 - minBary) * _WireframeColor.a;
+ }
+ }
+
+ [maxvertexcount(3)]
+ void wireframeGeom(triangle v2f IN[3], inout TriangleStream < v2f > tristream)
+ {
+ UNITY_BRANCH
+ if(_WireframeQuad)
+ {
+ float e1 = length(IN[0].localPos - IN[1].localPos);
+ float e2 = length(IN[1].localPos - IN[2].localPos);
+ float e3 = length(IN[2].localPos - IN[0].localPos);
+
+ float3 quad = 0;
+ if(e1 > e2 && e1 > e3)
+ quad.y = 1.;
+ else if(e2 > e3 && e2 > e1)
+ quad.x = 1;
+ else
+ quad.z = 1;
+
+ IN[0].barycentricCoordinates = fixed3(1, 0, 0) + quad;
+ IN[1].barycentricCoordinates = fixed3(0, 0, 1) + quad;
+ IN[2].barycentricCoordinates = fixed3(0, 1, 0) + quad;
+ }
+ else
+ {
+ IN[0].barycentricCoordinates = fixed3(1, 0, 0);
+ IN[1].barycentricCoordinates = fixed3(0, 1, 0);
+ IN[2].barycentricCoordinates = fixed3(0, 0, 1);
+ }
+
+
+
+ tristream.Append(IN[0]);
+ tristream.Append(IN[1]);
+ tristream.Append(IN[2]);
+ }
+ #else
+
+ float applyShadowWireframe(float2 uv, float3 barycentricCoordinates, float3 normal, float3 worldPos)
+ {
+ UNITY_BRANCH
+ if(_WireframeEnable)
+ {
+ float wireframeFadeAlpha = _WireframeAlpha;
+ float3 finalWireframeColor = 0;
+
+ float3 barys;
+ barys.xy = barycentricCoordinates;
+ barys.z = 1 - barys.x - barys.y;
+ float3 deltas = fwidth(barys);
+ float3 smoothing = deltas * _WireframeSmoothing;
+ float wireframeThickness = _WireframeThickness;
+ float3 thickness = deltas * wireframeThickness;
+ barys = smoothstep(thickness, thickness + smoothing, barys);
+ float minBary = min(barys.x, min(barys.y, barys.z));
+
+ return lerp(_WireframeEdgeOpacity, _WireframeFaceOpacity, minBary);
+ }
+ }
+
+ [maxvertexcount(3)]
+ void wireframeGeom(triangle V2FShadow IN[3], inout TriangleStream < V2FShadow > tristream)
+ {
+ IN[0].barycentricCoordinates = fixed3(1, 0, 0);
+ IN[1].barycentricCoordinates = fixed3(0, 1, 0);
+ IN[2].barycentricCoordinates = fixed3(0, 0, 1);
+ tristream.Append(IN[0]);
+ tristream.Append(IN[1]);
+ tristream.Append(IN[2]);
+ }
+ #endif
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiWireframe.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiWireframe.cginc.meta
new file mode 100644
index 00000000..078028da
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_PoiWireframe.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 76a781cfaa303314ba6102fabe3ff2e3
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_Poicludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_Poicludes.cginc
new file mode 100644
index 00000000..3943baf5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_Poicludes.cginc
@@ -0,0 +1,179 @@
+#ifndef POICLUDES
+#define POICLUDES
+
+UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST; float4 _MainTex_TexelSize;
+float _SpecularLMOcclusion;
+float _SpecLMOcclusionAdjust;
+sampler2D _PoiGrab;
+sampler2D _CameraDepthTexture;
+float _Cutoff;
+float _AlphaMod;
+
+//Structs
+struct appdata
+{
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float4 color: COLOR;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ uint vertexId: SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+};
+
+#ifdef OUTLINE
+ float _LineWidth;
+ float _OutlineEmission;
+ float4 _LineColor;
+ sampler2D _OutlineTexture; float4 _OutlineTexture_ST; float2 _OutlineTexturePan; float _OutlineTextureUV;
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+#endif
+
+struct PoiLighting
+{
+ half3 direction;
+ half3 color;
+ fixed attenuation;
+ #ifdef FORWARD_ADD_PASS
+ fixed additiveShadow;
+ #endif
+ half3 directLighting;
+ half3 indirectLighting;
+ half lightMap;
+ float3 rampedLightMap;
+ half3 finalLighting;
+ half3 halfDir;
+ half nDotL;
+ half nDotH;
+ half lDotv;
+ half lDotH;
+ half nDotV;
+ half N0DotV;
+ half diffuseTerm;
+ half occlusion;
+ // World normal dot half direction
+ #ifdef POI_VAR_DOTNH
+ half dotNH;
+ #endif
+
+ // Light direction dot half direction
+ #ifdef POI_VAR_DOTLH
+ half dotLH;
+ #endif
+
+ #ifdef VERTEXLIGHT_ON
+ // Non Important Lights
+ float4 vDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vDotLH;
+
+
+ #endif
+};
+
+struct PoiCamera
+{
+ half3 viewDir;
+ half3 tangentViewDir;
+ half3 decalTangentViewDir;
+ half3 forwardDir;
+ half3 worldPos;
+ float viewDotNormal;
+ float distanceToModel;
+ float distanceToVert;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float2 screenUV;
+ float4 clipPos;
+ #if defined(GRAIN)
+ float4 worldDirection;
+ #endif
+ float4 grabPos;
+};
+
+struct PoiMesh
+{
+ float3 normals[2];
+ float4 tangent;
+ float3 binormal;
+ float3 localPos;
+ float3 worldPos;
+ float3 modelPos;
+ float3 tangentSpaceNormal;
+ float2 uv[5];
+ float4 vertexColor;
+ fixed3 barycentricCoordinates;
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ float4 lightmapUV;
+ #endif
+ float isFrontFace;
+ #ifdef FUR
+ float furAlpha;
+ #endif
+};
+
+struct PoiTangentData
+{
+ float3x3 tangentTransform;
+ float3x3 tangentToWorld;
+};
+
+struct FragmentCommonData
+{
+ half3 diffColor, specColor;
+ // Note: smoothness & oneMinusReflectivity for optimization purposes, mostly for DX9 SM2.0 level.
+ // Most of the math is being done on these (1-x) values, and that saves a few precious ALU slots.
+ half oneMinusReflectivity, smoothness;
+ float3 normalWorld;
+ float3 eyeVec;
+ half alpha;
+ float3 posWorld;
+
+ #if UNITY_STANDARD_SIMPLE
+ half3 reflUVW;
+ #endif
+
+ #if UNITY_STANDARD_SIMPLE
+ half3 tangentSpaceNormal;
+ #endif
+};
+
+struct Debug
+{
+ float debug1;
+ float2 debug2;
+ float3 debug3;
+ float4 debug4;
+};
+
+struct PoiMods
+{
+ float4 audioLink;
+ fixed audioLinkTextureExists;
+ float4 globalMasks;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+};
+
+static Debug debug;
+static PoiLighting poiLight;
+static PoiCamera poiCam;
+static PoiMesh poiMesh;
+static PoiMods poiMods;
+static UnityGI gi;
+static FragmentCommonData s;
+static PoiTangentData poiTData;
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_Poicludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_Poicludes.cginc.meta
new file mode 100644
index 00000000..01275f8e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/CGI_Poicludes.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 13d25267a52e35b42a400164f5308ea2
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/Notes.txt b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/Notes.txt
new file mode 100644
index 00000000..32633192
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/Notes.txt
@@ -0,0 +1,7 @@
+// Transforms 2D UV by scale/bias property
+#define TRANSFORM_TEX(tex,name) (tex.xy * name##_ST.xy + name##_ST.zw)
+
+[HideInInspector][Vector2]Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] UV ("UV", Int) = 0
+
+:=--{reference_properties:[Pan, UV]} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/Notes.txt.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/Notes.txt.meta
new file mode 100644
index 00000000..1898d4ca
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Includes/Notes.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 80416ef83d06448418d413ca7aca0364
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders.meta
new file mode 100644
index 00000000..be77cdd5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 794d229bad37abe4ca9f26ba47fd1d0d
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders/S_Poiyomi_Pro.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders/S_Poiyomi_Pro.shader
new file mode 100644
index 00000000..179012ac
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders/S_Poiyomi_Pro.shader
@@ -0,0 +1,2024 @@
+Shader ".poiyomi/Patreon/★ Fur ★"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi Fur V7.3.028</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+ [HideInInspector] shader_properties_label_file ("7PlusLabels", Float) = 0
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ [HideInInspector] GeometryShader_Enabled("", Float) = 1
+
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ //FUR
+ [HideInInspector] m_furOptions("Fur", Float) = 0
+ _FurColor("Fur Color", Color) = (1, 1, 1, 1)
+ _FurTexture("Fur Texture", 2D) = "white" { }
+ _FurHeightMap("Fur Height Map", 2D) = "white" { }
+ _FurMask("Fur Mask", 2D) = "white" { }
+ _FurLength("Length", Range(0, .2)) = .025
+ _FurGravityStrength("Gravity Strength", Range(-1, 1)) = 0
+ [IntRange]_FurLayers("Layers", Range(0, 23)) = 23
+ _FurAO("AO", Range(0, 1)) = .5
+ [HideInInspector] m_start_furAdvanced("Advanced / Optimization", Float) = 0
+ _FurTipAlpha("Fur Tip Alpha", Range(0, 1)) = 1
+ _FurFadeStart("Fur Fade Start", Range(0, 1)) = 0
+ _AoRampMin("AO Ramp Min", Range(0, 1)) = 0.0
+ _AoRampMax("AO Ramp Max", Range(0, 1)) = 1.0
+ _FurHeightMapMin("Height Map Min", Range(0, 1)) = 0.0
+ _FurHeightMapMax("Height Map Max", Range(0, 1)) = 1.0
+ _FurMinDistance("Min Distance", Float) = 2.0
+ _FurMaxDistance("Max Distance", Float) = 10.0
+ [HideInInspector] m_end_furAdvanced("Advanced / Optimization", Float) = 0
+
+ // Main
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _MainTex ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainTextureUV ("UV", Int) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ClippingMaskUV ("UV", Int) = 0
+ [ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+
+ //Hue Shifting
+ [HideInInspector] m_start_MainHueShift ("Color Adjust", Float) = 0
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?", Float) = 1
+ _MainHueShift ("Hue Shift", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed", Float) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness("Brightness", Range(-1,1)) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)]_MainHueShiftToggle ("Toggle Hueshift", Float) = 0
+ _MainColorAdjustTexture ("Mask R(H) G(S) B(B)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ _RGBMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBMaskPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color", Color) = (1, 1, 1, 1)
+ _RedTexure ("R Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBRedPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBRed_UV ("UV", int) = 0
+ _GreenColor ("G Color", Color) = (1, 1, 1, 1)
+ _GreenTexture ("G Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBGreenPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBGreen_UV ("UV", int) = 0
+ _BlueColor ("B Color", Color) = (1, 1, 1, 1)
+ _BlueTexture ("B Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBBluePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBBlue_UV ("UV", int) = 0
+ _AlphaColor ("A Color", Color) = (1, 1, 1, 1)
+ _AlphaTexture ("A Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBAlphaPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBAlpha_UV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalRPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalGPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalBPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalAPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Detail Options
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=9oIcQln9of4&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture Tint", Color) = (1, 1, 1)
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ // Vertex Colors
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ //Vertex Manipulations
+ [HideInInspector] m_start_vertexManipulation ("Vertex Offset--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Division Amount", Float) = 500
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ // Alpha Options
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ _Cutoff ("Alpha Cuttoff", Range(0, 1.001)) = 0.5
+ [ToggleUI]_DitheringEnabled ("Enable Dithering", Float) = 0
+ _DitherGradient ("Dither Gradient", Range(0, 1)) = .1
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 0
+ _MainShadowClipMod ("Shadow Clip Mod", Range(-1, 1)) = 0
+ [Enum(Off, 0, On, 1)] _AlphaToMask ("Alpha To Coverage", Float) = 0
+ [ToggleUI]_MainAlphaToCoverage ("Sharpenned A2C--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Float) = 0
+ _MainMipScale ("Mip Level Alpha Scale--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Range(0, 1)) = 0.25
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_DecalEnabled}", Float) = 0
+ _DecalMask ("Decal RGBA Mask--{reference_properties:[_DecalMaskPan, _DecalMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalMaskUV ("UV", Int) = 0
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ _DecalColor ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed", Float) = 0
+ _DecalHueShift ("Hue Shift", Range(0,1)) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ _DecalColor1 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled1 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed", Float) = 0
+ _DecalHueShift1 ("Hue Shift", Range(0,1)) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ _DecalColor2 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled2 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed", Float) = 0
+ _DecalHueShift2 ("Hue Shift", Range(0,1)) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ _DecalColor3 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled3 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed", Float) = 0
+ _DecalHueShift3 ("Hue Shift", Range(0,1)) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face", Float) = 0
+ [ToggleUI]_BackFaceEnabled ("Enable Back Face Options", Float) = 0
+ _BackFaceColor ("Color", Color) = (1, 1, 1, 1)
+ _BackFaceTexture ("Texture", 2D) = "white" { }
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ [HideInInspector][Vector2]_BackFacePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ _BackFaceHueShift ("Hue Shift", Range(0, 1)) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingOptions ("Lighting", Float) = 0
+ [HideInInspector] m_start_Lighting ("Light and Shadow", Float) = 0
+ [Toggle(VIGNETTE_MASKED)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Toon, 0, Realistic, 1, Wrapped (Beta), 2, Skin (Beta), 3, Flat, 4)] _LightingMode ("Lighting Type", Int) = 4
+ _LightingStandardSmoothness ("Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==1}}", Range(0, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}", Range(0, 1)) = 0
+ [Enum(Ramp Texture, 0, Math Gradient, 1, Shade Mapping, 2)] _LightingRampType ("Ramp Type--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}}}}", Int) = 0
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Color) = (1,1,1,1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", 2D) = "white" {}
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask("1st ShadeMap.a As ShadowMask", Float ) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse("1st ShadeMapMask Inverse", Float ) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}}", Float ) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Color) = (1,1,1,1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", 2D) = "white" {}
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask("2nd ShadeMap.a As ShadowMask", Float ) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse("2nd ShadeMapMask Inverse", Float ) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Float ) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.01, 1)) = 0
+ _1st2nd_Shades_Feather ("1st/2nd_Shades_Feather--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.0001, 1)) = 0.0001
+
+ // Ramp
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==0}}}", 2D) = "white" { }
+ _LightingShadowMask ("Ramp Mask--{reference_properties:[_LightingShadowMaskPan, _LightingShadowMaskUV],condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingShadowMaskUV ("UV", Int) = 0
+ _ShadowOffset ("Ramp Offset--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==0}}}}", Range(-1, 1)) = 0
+ //Math
+ _LightingGradientStart ("Gradient Start--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==1}}}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==1}}}", Range(0, 1)) = .5
+ // Skin
+ _SkinLUT ("LUT--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", 2D) = "white" {}
+ //_SssMaskCutoff ("Mask Cutoff--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0.01,1)) = 0.1
+ //_SssBias ("Bias--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 0
+ _SssScale ("Scale--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 0.7
+ [HideInInspector][Vector3]_SssTransmissionAbsorption ("Absorption--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Vector) = (-8,-40,-64,0)
+ [HideInInspector][Vector3]_SssColorBleedAoWeights ("AO Color Bleed--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Vector) = (0.4,0.15,0.13,0)
+ _LightingShadowColor ("Shadow Tint--{reference_property:_LightingDetailShadowsEnabled, condition_showS:(_LightingMode==0&&_LightingRampType!=2)||_LightingMode==2||_LightingMode==3}", Color) = (1, 1, 1, 1)
+ _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode==0&&_LightingRampType!=2)||_LightingMode==2}", Range(0, 1)) = 1
+ _AttenuationMultiplier ("Receive Casted Shadows--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode!=4}}", Range(0, 1)) = 0
+ [ToggleUI]_LightingIgnoreAmbientColor ("Ignore Ambient Color--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode!=4},condition2:{type:PROPERTY_BOOL,data:_LightingMode!=1}}}", Float) = 0
+
+ //_LightingShadowMap ("Shadow Color(RGB) and wrap(A)--{reference_properties:[_LightingShadowMapPan, _LightingShadowMapUV],condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}}", 2D) = "white" { }
+ //[HideInInspector][Vector2]_LightingShadowMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ //[HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingShadowMapUV ("UV", Int) = 0
+
+ [HideInInspector] m_start_lightingModifiers ("Lighting Modifiers", Float) = 0
+ [Enum(Poi Custom, 0, Correct, 1)] _LightingDirectColorMode ("Direct Light Color", Int) = 0
+ [ToggleUI]_LightingIndirectColorMode ("Indirect Uses Normals", Float) = 0
+ [ToggleUI]_LightingUncapped ("Uncapped Lighting", Float) = 0
+ [ToggleUI]_LightingOnlyUnityShadows ("Only Unity Shadows", Float) = 0
+ _LightingMonochromatic ("Monochromatic Lighting?", Range(0,1)) = 0
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingMinShadowBrightnessRatio ("Shadow:Light min Ratio", Range(0, 1)) = 0
+ [HideInInspector] m_end_lightingModifiers ("Lighting Modifiers", Float) = 0
+
+ [HideInInspector] m_start_detailShadows ("Detail Shadows--{reference_property:_LightingDetailShadowsEnabled, condition_show:{type:PROPERTY_BOOL,data:_LightingMode!=4}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingDetailShadowsEnabled ("Enabled Detail Shadows?", Float) = 0
+ _LightingDetailShadows ("Detail Shadows--{reference_properties:[_LightingDetailShadowsPan, _LightingDetailShadowsUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingDetailShadowsUV ("UV", Int) = 0
+ _LightingDetailStrength ("Detail Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_detailShadows ("Detail Shadows", Float) = 0
+
+ [HideInInspector] m_start_ambientOcclusion ("Ambient Occlusion--{reference_property:_LightingEnableAO}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingEnableAO ("Enable AO", Float) = 0
+ _LightingAOTex ("AO Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingAOTexUV ("UV", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_ambientOcclusion ("Ambient Occlusion", Float) = 0
+
+ // HSL Lighting
+ [HideInInspector] m_start_lightingHSL ("HSL Lighting--{reference_property:_LightingEnableHSL, condition_show:{type:PROPERTY_BOOL,data:_LightingMode==0}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingEnableHSL ("Enabled HSL Lighting", Float) = 0
+ _LightingHSLIntensity ("Shadow HSL Intensity", Range(0, 1)) = 1
+ _LightingShadowHue ("Shadow Hue Change", Range(0, 1)) = 0.5
+ _LightingShadowSaturation ("Shadow Saturation Change", Range(0, 1)) = 0.5
+ _LightingShadowLightness ("Shadow Lightness Change", Range(0, 1)) = 0.5
+ [HideInInspector] m_end_lightingHSL ("HSL Lighting", Float) = 0
+
+ // point/spot Light Settings
+ [HideInInspector] m_start_lightingAdvanced ("Additive Lighting (Point/Spot)--{reference_property:_LightingAdditiveEnable,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=at3p5yRRVU0&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw&index=12},hover:YouTube}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [Enum(Realistic, 0, Toon, 1, Wrapped, 2)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End", Range(0, 1)) = .5
+ _LightingAdditivePassthrough ("Point Light Passthrough", Range(0, 1)) = .5
+ _LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1
+ [ToggleUI]_LightingAdditiveLimitIntensity ("Limit Intensity", Float) = 0
+ _LightingAdditiveMaxIntensity ("Max Intensity--{condition_show:{type:PROPERTY_BOOL,data:_LightingAdditiveLimitIntensity==1}}", Range(0, 3)) = 1
+ [ThryToggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)]_DisableDirectionalInAdd ("No Directional", Float) = 1
+ [HideInInspector] m_end_lightingAdvanced ("Additive Lighting", Float) = 0
+ [HideInInspector] m_end_Lighting ("Light and Shadow", Float) = 0
+
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [ThryToggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSThicknessMap ("Thickness Map--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSSCale ("Light Strength", Range(0, 1)) = 0.25
+ _SSSPower ("Light Spread", Range(1, 100)) = 5
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+ /*
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [ThryToggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSStrength ("Strength", Float) = 4
+ _SSSConstant ("Constant", Range(0, .5)) = 0.1
+ _SSSNDotL ("NDotL Reduction", Range(0, 1)) = 0
+ _SSSExponent ("Spot Exponent", Range(2, 100)) = 30
+ _SSSNormalOffset ("Scattering", Range(0, .3)) = 0.05
+ _SSSPointLightDirectionality ("Point Light Directionality", Range(0, 1)) = .7
+ _SSSThicknessMap ("Thickness Map--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ [HideInInspector]_SSSThickness ("Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+ */
+
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting", Float) = 0
+ [ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [Enum(vertex, 0, pixel, 1)] _RimLightNormal ("Normal Select", Int) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 1
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimMaskUV ("UV", Int) = 0
+
+ [HideInInspector] m_start_rimHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_RimHueShiftEnabled ("Enabled", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed", Float) = 0
+ _RimHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_rimHueShift ("Hue Shift", Float) = 0
+
+ // Rim Noise
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_RimWidthNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimWidthNoiseTextureUV ("UV", Int) = 0
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Environmental Rim Lighting
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [ThryToggle(_MAPPING_6_FRAMES_LAYOUT)]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+
+ // Baked Lighting
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ _SpecularLMOcclusion("Specular Occlusion", Range(0,1)) = 0
+ _SpecLMOcclusionAdjust("Spec Occlusion Sensitiviy", Range(0,1)) = 0.2
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ [Helpbox(3)] _LockTooltip ("ALWAYS LOCK IN BEFORE UPLOADING. || RIGHT CLICK A PROPERTY IF YOU WANT TO ANIMATE IT.", Int) = 0
+
+ // BRDF
+ [HideInInspector] m_start_brdf ("Metallics & Specular--{reference_property:_EnableBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_CLASSIC)]_EnableBRDF ("Enable", Float) = 0
+ _BRDFMetallicGlossMap ("Metallic Gloss Map--{reference_properties:[_BRDFMetallicGlossMapPan, _BRDFMetallicGlossMapUV, _BRDFInvertGlossiness, _BRDFMetallicGlossMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFMetallicGlossMapToolTip ("R = Metallic, G = Reflectance, A = Glossiness/Smoothness/Inverse Roughness", Int) = 0
+ [HideInInspector][ToggleUI]_BRDFInvertGlossiness ("Invert Glossiness", Float) = 0
+ [HideInInspector][Vector2]_BRDFMetallicGlossMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFMetallicGlossMapUV ("UV", Int) = 0
+ _BRDFSpecularMap ("Specular Tint/Mask--{reference_properties:[_BRDFSpecularMapPan, _BRDFSpecularMapUV, _BRDFSpecularMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFSpecularMapToolTip ("RGB = Color, A = Mask", Int) = 0
+ [HideInInspector][Vector2]_BRDFSpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFSpecularMapUV ("UV", Int) = 0
+ _BRDFMetallicMap ("Metallic Tint/Mask--{reference_properties:[_BRDFMetallicMapPan, _BRDFMetallicMapUV, _BRDFMetallicMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFMetallicMapToolTip ("RGB = Color, A = Mask", Int) = 0
+ [HideInInspector][Vector2]_BRDFMetallicMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFMetallicMapUV ("UV", Int) = 0
+ _BRDFMetallic ("Metallic", Range(0,1)) = 0
+ _BRDFGlossiness ("Glossiness", Range(0,1)) = 0
+ _BRDFReflectance ("Reflectance", Range(0,1)) = .5
+ _BRDFAnisotropy ("Anisotropy", Range(-1,1)) = 0
+ [ToggleUI]_BRDFReflectionsEnabled ("Enable Reflections", Float) = 1
+ [ToggleUI]_BRDFSpecularEnabled ("Enable Specular", Float) = 1
+ _BRDFFallback ("Fallback Reflection", Cube) = "" { }
+ [ToggleUI]_BRDFForceFallback ("Force Fallback Reflection", Range(0, 1)) = 0
+ [HideInInspector] m_end_brdf ("Baked Lighting", Float) = 0
+
+ // Metallics
+ [HideInInspector] m_start_Metallic ("Metallicsa", Float) = 0
+ [ThryToggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicTintMap ("Tint Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicTintMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MetallicTintMapUV ("UV", Int) = 0
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MetallicMaskUV ("UV", Int) = 0
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SmoothnessMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SmoothnessMaskUV ("UV", Int) = 0
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_Metallic ("Metallics", Float) = 0
+
+ // Clearcoat
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [ThryToggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ //[Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ //_ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearcoatMap ("Clear Coat Map--{reference_properties:[_ClearcoatMapPan, _ClearcoatMapUV, _ClearcoatInvertSmoothness, _ClearcoatHelpBox]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _ClearcoatHelpBox ("R = Clear Coat Map, G = Specular Mask, B = Reflection Mask, A = Glossiness/Smoothness/Inverse Roughness", Int) = 0
+ [HideInInspector][Vector2]_ClearcoatMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ClearcoatMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearcoatInvertSmoothness ("Invert Smoothness", Range(0, 1)) = 0
+ _Clearcoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearcoatGlossiness ("Smoothness", Range(0, 1)) = 0
+ _ClearcoatAnisotropy ("Anisotropy", Range(-1, 1)) = 0
+ [ToggleUI]_ClearcoatEnableReflections ("Enable Reflections", Range(0, 1)) = 1
+ [ToggleUI]_ClearcoatEnableSpecular ("Enable Specular", Range(0, 1)) = 1
+ _ClearcoatFallback ("Fallback CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearcoatForceFallback ("Force Fallback Cubemap", Range(0, 1)) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap / Sphere Textures", Float) = 0
+ [ThryToggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [HideInInspector] m_start_matcapHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_MatcapHueShiftEnabled ("Enabled", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed", Float) = 0
+ _MatcapHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_matcapHueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_matcap ("Matcap", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [HideInInspector] m_start_matcap2HueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_Matcap2HueShiftEnabled ("Enabled", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed", Float) = 0
+ _Matcap2HueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_matcap2HueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ // Specular
+ [HideInInspector] m_start_specular ("Specular Reflections", Float) = 0
+ [ThryToggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal ("Normal Select", Int) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic ("Metallic", Range(0, 1)) = 0
+ _SpecularMaxBrightness("Max Light Brightness", Float) = 0
+ [Gradient]_SpecularMetallicMap ("Metallic Map--{reference_properties:[_SpecularMetallicMapPan, _SpecularMetallicMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMetallicMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMetallicMapUV ("UV", Int) = 0
+ _SpecularSmoothness ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType==3}}}", Range(0, 1)) = 1
+ [Gradient]_SpecularMap ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMapUV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMaskUV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ // Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _Spec1Offset ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMapPan, _AnisoTangentMapUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _AnisoTangentMapUV ("UV", Int) = 0
+ //toon aniso
+ _SpecularToonStart ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicroPan, _SpecularAnisoJitterMicroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacroPan, _SpecularAnisoJitterMacroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMacroUV ("UV", Int) = 0
+ // Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular ("Specular Reflections", Float) = 0
+
+ // Second Specular
+ [HideInInspector] m_start_specular1 ("Specular Reflections 2", Float) = 0
+ [ThryToggle(DITHERING)]_EnableSpecular1 ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType1 ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal1 ("Normal Select", Int) = 1
+ _SpecularTint1 ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic1 ("Metallic", Range(0, 1)) = 0
+ _SpecularMaxBrightness1("Max Light Brightness", Float) = 0
+ [Gradient]_SpecularMetallicMap1 ("Metallic Map--{reference_properties:[_SpecularMetallicMapPan, _SpecularMetallicMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMetallicMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMetallicMap1UV ("UV", Int) = 0
+ _SpecularSmoothness1 ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==3}}}", Range(-2, 1)) = .75
+ _SpecularMap1 ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMap1UV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness1 ("Invert Smoothness", Float) = 0
+ _SpecularMask1 ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMask1UV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom1 ("Smoothness From", Int) = 1
+ // Second Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent1 ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Int) = 0
+ _AnisoSpec1Alpha1 ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha1 ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _Spec1Offset1 ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness1 ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap1 ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Float) = 0
+ _AnisoTangentMap1 ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMap1Pan, _AnisoTangentMap1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _AnisoTangentMap1UV ("UV", Int) = 0
+ // Second toon aniso
+ _SpecularToonStart1 ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd1 ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor1 ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored1 ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro1 ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicro1Pan, _SpecularAnisoJitterMicro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier1 ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMicro1UV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro1 ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacro1Pan, _SpecularAnisoJitterMacro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier1 ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMacro1UV ("UV", Int) = 0
+ // Second Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter1 ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular1 ("Specular Reflections", Float) = 0
+
+ // First Emission
+ [HideInInspector] m_Special_Effects ("Special Effects", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission / Glow", Float) = 0
+ [ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMapUV ("UV", Int) = 0
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMaskUV ("UV", Int) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed", Float) = 0
+
+ // Center out emission
+ [HideInInspector] m_start_CenterOutEmission ("Center Out Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionCenterOutEnabled ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission ("inward out emission", Float) = 0
+
+ // Glow in the dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [HideInInspector][ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionBlinkingEnabled ("Enable Blinking", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ // Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [HideInInspector][ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position", float) = 0
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ _EmissionScrollingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ // Emission Audio Link
+ [HideInInspector] m_start_EmissionAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [ToggleUI] _EnableEmissionStrengthAudioLink ("multiply Emission Strength", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionStrengthBand ("Emission Strength Band", Int) = 0
+ [ToggleUI] _EnableEmissionCenterOutAudioLink ("Center Out multipy", Float) = 0
+ _EmissionCenterOutAudioLinkWidth("C Out Mul Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionCenterOutBand ("Center Out M Band", Int) = 0
+ [Vector2] _EmissionCenterOutAddAudioLink ("Center Out Add", Vector) = (0,0,0,0)
+ _EmissionCenterOutAddAudioLinkwidth("C Out Add Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionCenterOutAddBand ("Center Out A Band", Int) = 0
+ [Vector2]_AudioLinkAddEmission ("Emission Strength Add", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkAddEmissionBand ("Emission Add Band", Int) = 0
+ [HideInInspector] m_end_EmissionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_emissionOptions ("Emission / Glow", Float) = 0
+
+ // Second Enission
+ [HideInInspector] m_start_emission1Options ("Emission / Glow 2 (Requires Emission 1 Enabled)", Float) = 0
+ [ThryToggle(EFFECT_HUE_VARIATION)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap1 ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMap1UV ("UV", Int) = 0
+ _EmissionMask1 ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMask1UV ("UV", Int) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled1 ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed", Float) = 0
+
+
+ // Second Center Out Enission
+ [HideInInspector] m_start_CenterOutEmission1 ("Center Out Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionCenterOutEnabled1 ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission1 ("inward out emission", Float) = 0
+
+ // Second Glow In The Dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [HideInInspector][ToggleUI]_EnableGITDEmission1 ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Second Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionBlinkingEnabled1 ("Enable Blinking", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+
+ // Scrolling Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions1 ("Scrolling Emission", Float) = 0
+ [HideInInspector][ToggleUI] _ScrollingEmission1 ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position", float) = 0
+ _EmissiveScroll_Direction1 ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval", Float) = 20
+ _EmissionScrollingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmission1Options ("Scrolling Emission", Float) = 0
+
+ // Emission Audio Link
+ [HideInInspector] m_start_Emission1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [ToggleUI] _EnableEmission1StrengthAudioLink ("Emission Strength", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1StrengthBand ("Emission Strength Band", Int) = 0
+ [ToggleUI] _EnableEmission1CenterOutAudioLink ("Center Out multipy", Float) = 0
+ _Emission1CenterOutAudioLinkWidth("C Out Mul Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band", Int) = 0
+ [Vector2] _EmissionCenterOutAddAudioLink1 ("Center Out Add", Vector) = (0,0,0,0)
+ _Emission1CenterOutAddAudioLinkwidth("C Out Add Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutAddBand ("Center Out A Band", Int) = 0
+ [Vector2]_AudioLinkAddEmission1 ("Emission Strength Add", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkAddEmission1Band ("Emission Add Band", Int) = 0
+ [HideInInspector] m_end_Emission1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_emission1Options ("Emission / Glow 2", Float) = 0
+
+ // Poiyomi Pathing
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(TONEMAPPING_CUSTOM)] _EnablePathing ("Enable Pathing", Float) = 0
+ _PathingMap ("RGB Path Map | A Mask--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _PathingColorMap ("RGB Color | A Mask--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _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
+ [HDR]_PathColorR ("R Color", Color) = (1, 1, 1)
+ [HDR]_PathColorG ("G Color", Color) = (1, 1, 1)
+ [HDR]_PathColorB ("B Color", Color) = (1, 1, 1)
+ [Vector3]_PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 1)
+ [Vector3]_PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ [Vector3]_PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1)
+ [Vector3]_PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 1)
+ [Header(Timing Options)]
+ [Vector3]_PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, 1)
+ [Vector3]_PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 1)
+ [Vector3]_PathSegments ("Path Segments", Vector) = (0.0, 0.0, 0.0, 1)
+ [HideInInspector] m_start_PathAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ // Time Offsets
+ [Header(Time Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B", Vector) = (0, 0, 0)
+
+ // Emission Offsets
+ [Header(Emission Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Emission R", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Emission G", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Emission B", Vector) = (0, 0, 0, 0)
+
+ // Length Offsets
+ [Header(Length Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_PathAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_pathing ("Pathing", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook", Float) = 0
+ [ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _FlipbookTexArrayUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _FlipbookMaskUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha("Alpha Mod", Vector) = (1,1,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission("Emission Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame("Frame control", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+
+ // Flipbook Manual Control
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+
+ [HideInInspector] m_start_crossfade ("Crossfade", Float) = 0
+ [ToggleUI]_FlipbookCrossfadeEnabled("Enable Crossfade?", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range", Vector) = (0.75, 1, 0, 1)
+ [HideInInspector] m_end_crossfade ("Crossfade", Float) = 0
+
+ [HideInInspector] m_start_flipbookHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_FlipbookHueShiftEnabled ("Enabled", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed", Float) = 0
+ _FlipbookHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_flipbookHueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve", Float) = 0
+ [ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolved Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_dissolveMasking ("Effect Masking", Float) = 0
+ [Enum(Undissolved, 0, Dissolved, 1, Both, 2)] _DissolveEmissionSide ("Emission 1", Int) = 2
+ [Enum(Undissolved, 0, Dissolved, 1, Both, 2)] _DissolveEmission1Side ("Emission 2", Int) = 2
+ [HideInInspector] m_end_dissolveMasking ("Effect Masking", Float) = 0
+
+ // Point to Point Dissolve
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1, Vertex Colors, 2)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0,1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+
+ [HideInInspector] m_start_dissolveAudioLink ("Audio Link ♫--{reference_property:_EnableDissolveAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDissolveAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_dissolveAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Panosphere
+ [HideInInspector] m_start_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [ThryToggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ [ToggleUI]_PanoInfiniteStereoToggle ("Infinite Stereo", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_PanoMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _PanoMaskUV ("UV", Int) = 0
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+ [HideInInspector] m_end_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle", Float) = 0
+ [ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [Enum(Angle, 0, Linear Emission, 1)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color", Color) = (1, 1, 1)
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0,0,0,0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(0, 1)) = .8
+ _GlitterHideInShadow("Hide in shadow", Range(0,1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [HideInInspector] m_start_glitterHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_GlitterHueShiftEnabled ("Enabled", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed", Float) = 0
+ _GlitterHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_glitterHueShift ("Hue Shift", Float) = 0
+
+ // Glitter Random Colors
+ [HideInInspector] m_start_glitterRandom ("Random Things", Float) = 0
+ [ToggleUI]_GlitterRandomColors ("Random Colors", Float) = 0
+ [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1)
+ [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1)
+ [ToggleUI]_GlitterRandomSize("Random Size?", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation("Random Tex Rotation", Float) = 0
+ [HideInInspector] m_end_glitterRandom ("Random Colors", Float) = 0
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("MSDF Text Overlay", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS", Float) = 0
+ [ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color", Color) = (1, 1, 1, 1)
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextFPS ("FPS", Float) = 0
+
+ // POSITION
+ [HideInInspector] m_start_TextPosition ("Position", Float) = 0
+ [ToggleUI]_TextPositionEnabled ("Position Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color", Color) = (1, 0, 1, 1)
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextPosition ("Position", Float) = 0
+
+ // INSTANCE TIME
+ [HideInInspector] m_start_TextInstanceTime ("Instance Time", Float) = 0
+ [ToggleUI]_TextTimeEnabled ("Time Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color", Color) = (1, 0, 1, 1)
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror", Float) = 0
+ [ThryToggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MirrorTextureUV ("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ // Distance Fade
+ [HideInInspector] m_start_distanceFade ("Distance Fade", Float) = 0
+ _MainFadeTexture ("Fade Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainFadeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainFadeTextureUV ("UV", Int) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _MainFadeType ("Pos To Use", Int) = 1
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainMaxAlpha ("Maximum Alpha", Range(0, 1)) = 1
+ _MainDistanceFadeMin ("Distance Min", Float) = 0
+ _MainDistanceFadeMax ("Distance Max", Float) = 0
+ [HideInInspector] m_end_distanceFade ("Distance Fade", Float) = 0
+
+ // Angular Fade
+ [HideInInspector] m_start_angularFade ("Angular Fade", Float) = 0
+ [ThryToggle(_SUNDISK_NONE)]_EnableRandom ("Enable Angular Fade", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_angularFade ("Angular Fade", Float) = 0
+
+ // UV Distortion
+ [HideInInspector] m_start_distortionFlow ("UV Distortion", Float) = 0
+ [ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1", 2D) = "black" { }
+ _DistortionFlowTexture1 ("Distortion Texture 2", 2D) = "black" { }
+ _DistortionStrength ("Strength1", Float) = 0.5
+ _DistortionStrength1 ("Strength2", Float) = 0.5
+ [Vector2]_DistortionSpeed ("Speed1", Vector) = (0.5, 0.5, 0, 0)
+ [Vector2]_DistortionSpeed1 ("Speed2", Vector) = (0.5, 0.5, 0, 0)
+
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_distortionFlow ("UV Distortion", Float) = 0
+
+ // Audio link
+ [HideInInspector] m_start_audioLink ("Audio Link--{reference_property:_EnableAudioLink}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_LOG_VIEW)] _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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ _AudioLinkDelay ("Delay", Range(0,1)) = 0
+ [ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ _AudioLinkAverageRange ("Average Sampling Range", Range(0,1)) = .5
+ // Debug
+ [HideInInspector] m_start_audioLinkDebug ("Debug--{reference_property:_EnableAudioLinkDebug}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableAudioLinkDebug("Enable?", Float) = 0
+ _AudioLinkDebugTreble ("Treble", Range(0,1)) = 0
+ _AudioLinkDebugHighMid ("High Mid", Range(0,1)) = 0
+ _AudioLinkDebugLowMid ("Low Mid", Range(0,1)) = 0
+ _AudioLinkDebugBass ("Bass", Range(0,1)) = 0
+ [ToggleUI] _AudioLinkDebugAnimate ("Debug Animate", Float) = 0
+ [ToggleUI]_AudioLinkTextureVisualization("Visualize Texture", Float) = 0
+ [HideInInspector] m_end_audioLinkDebug ("Debug", Float) = 0
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ // Start Patreon
+ [HideInInspector] m_Patreon ("Patreon", Float) = 0
+
+ // Video Options
+ [HideInInspector] m_start_Video ("Video--{reference_property:_EnableVideo}", Float) = 0
+ [ThryToggle(BLOOM)] _EnableVideo ("Enable Video", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _VideoUVNumber ("Screen UV#", Int) = 0
+ [Enum(LCD, 0, TN, 1, CRT, 2, OLED, 3, Gameboy, 4, Projector, 5)] _VideoType ("Screen Type", Int) = 3
+ _VideoBacklight ("Brightness", Range(0, 100)) = 1
+ [ToggleUI]_VideoEmissionEnabled ("Emission Enabled", Float) = 1
+ _VideoPixelTexture ("Pixel Texture", 2D) = "white" { }
+ [Vector2]_VideoResolution ("Resolution", Vector) = (1280, 720, 0)
+ _VideoMaskTexture ("Mask", 2D) = "white" { }
+ [Vector2]_VideoMaskPanning ("Mask Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_VideoSettings ("Video Texture Settings", Float) = 0
+ [ToggleUI]_VideoEnableVideoPlayer ("Enable Video Player", Float) = 0
+ [ToggleUI]_VideoPixelateToResolution ("Pixelate To Resolution", Float) = 0
+ [ToggleUI]_VideoRepeatVideoTexture ("Clamp To UV", Float) = 0
+ [Vector2]_VideoPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_VideoTiling ("Tiling", Vector) = (1, 1, 0, 0)
+ [Vector2]_VideoOffset ("Offset", Vector) = (0, 0, 0, 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_VideoDebug ("Video Debug", Float) = 0
+ [ToggleUI]_VideoEnableDebug ("Enable Debug", Float) = 0
+ _VideoDebugTexture ("Video Debug Tex", 2D) = "white" { }
+ [HideInInspector] m_end_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_start_CRT ("CRT Options", 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", Float) = 0
+ [Gradient]_VideoGameboyRamp ("Color Ramp", 2D) = "white" { }
+ [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Video ("Video", Float) = 0
+
+ // TouchFX
+ [HideInInspector] m_start_TouchOptions ("Touch FX", Float) = 0
+ [HideInInspector] m_start_Bulge ("Bulge--{reference_property:_EnableBulge}", Float) = 0
+ [ThryToggle(BLOOM_LOW)] _EnableBulge ("Bulge", Float) = 0
+ _BulgeMask ("Bulge Mask", 2D) = "white" { }
+ _BuldgeFadeLength ("Touch Distance", Float) = 0.02
+ _BuldgeHeight ("Bulge Height", Range(-0.2, 0.2)) = 0.02
+ [HideInInspector] m_end_Bulge ("Bulge", Float) = 0
+
+ [HideInInspector] m_start_TouchGlow ("Touch Color--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Touch Color", Float) = 0
+ [Enum(Depth, 0, UVs, 1)] _DepthGradientTextureUV ("UVs From", Int) = 0
+ [Enum(Replace, 0, Add, 1, Multiply, 2)] _DepthGradientBlend ("Color Blend", Int) = 0
+ _DepthGlowColor ("Depth Glow Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DepthGradient ("Depth Gradient--{reference_properties:[_DepthGradientPan, _DepthGradientUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthGradientPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DepthGradientUV ("UV", Int) = 0
+ _DepthMask ("Depth Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DepthMaskUV ("UV", Int) = 0
+ _DepthGlowEmission ("Depth Glow Emission", Float) = 3
+ _FadeLength ("Fade Length", Float) = 20
+ _DepthAlphaMin ("Alpha Min", Range(0, 1)) = 1
+ _DepthAlphaMax ("Alpha Max", Range(0, 1)) = 1
+ [HideInInspector] m_end_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchOptions ("Touch FX", Float) = 0
+
+ // Hologram
+ [HideInInspector] m_start_Hologram ("Hologram Alpha--{reference_property:_EnableHolo}", Float) = 0
+ [ThryToggle(DEPTH_OF_FIELD)]_EnableHolo ("Enable Hologram Alpha", Float) = 0
+ [Curve]_HoloAlphaMap ("Alpha Map", 2D) = "white" { }
+ [Enum(World Space, 0, Local Space, 1, UV, 2)]_HoloCoordinateSpace ("Coordinate Space", Int) = 0
+ _HoloDirection ("Scroll Direction", Vector) = (0, 1, 0)
+ _HoloLineDensity ("Line Density", Float) = 10
+ _HoloScrollSpeed ("Scroll Speed", Float) = 1
+ [HideInInspector] m_start_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ _HoloFresnelAlpha ("Intensity", Range(0, 1)) = 0
+ _HoloRimSharpness ("Sharpness", Range(0, 1)) = .5
+ _HoloRimWidth ("Width", Range(0, 1)) = .5
+ [HideInInspector] m_end_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_Hologram ("Hologram Alpha", Float) = 0
+
+ // Iridescence
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [ThryToggle(BLOOM_LENS_DIRT)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp", 2D) = "white" { }
+ _IridescencePanSpeed ("Pan", Float) = 0
+ _IridescenceOffset ("Offset", Float) = 0
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map", 2D) = "bump" { }
+ _IridescenceMask ("Mask", 2D) = "white" { }
+ _IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _IridescenceNormalUV ("Normal UV", Int) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _IridescenceMaskUV ("Mask UV", Int) = 0
+ [Enum(vertex, 0, pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Enum(Run Early, 0, Run Late, 1)] _IridescenceTime ("When To Run", Int) = 0
+ [Header(Hue Shift)]
+ [ToggleUI]_IridescenceHueShiftEnabled ("Hue Shift Enabled", Float) = 0
+ _IridescenceHueShiftSpeed ("Shift Speed", Float) = 0
+ _IridescenceHueShift ("Hue Shift", Range(0,1)) = 0
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionBand ("Scale Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmission("Scale Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // Vertex Glitching
+ [HideInInspector] m_start_VertexGlitch ("Vertex Glitching--{reference_property:_EnableVertexGlitch}", Float) = 0
+ [ToggleUI]_EnableVertexGlitch ("Enable Vertex Glitching", Float) = 0
+ _VertexGlitchFrequency ("Glitch Interval", Float) = 0
+ _VertexGlitchThreshold ("Glitch Threshold", Range(0, 1)) = 1
+ _VertexGlitchStrength ("Glitch Strength", Range(0, 10)) = 1
+ [HideInInspector] m_end_VertexGlitch ("Vertex Glitching", Float) = 0
+
+ // Spawn In Effects
+ [HideInInspector] m_start_Spawns ("Spawns", Float) = 0
+ [HideInInspector] m_start_ScifiSpawnIn ("Sci Fi--{reference_property:_EnableScifiSpawnIn}", Float) = 0
+ [HideInInspector][ToggleUI]_EnableScifiSpawnIn ("Enable Sci Fi Spawn", Float) = 0
+ _SpawnInNoise ("Spawn Noise", 2D) = "black" { }
+ _SpawnInNoiseIntensity ("Noise Intensity", Range(0, 1)) = .35
+ _SpawnInAlpha ("Spawn Alpha", Range(0, 1)) = 0
+ [Vector3]_SpawnInGradientStart ("Gradient Start", Vector) = (0, 2, 0)
+ [Vector3]_SpawnInGradientFinish ("Gradient End", Vector) = (0, -2, 0)
+ [HDR]_SpawnInEmissionColor ("Emission Color", Color) = (1, 1, 1)
+ _SpawnInEmissionOffset ("Emission Width", Range(0, 1)) = .1
+ _SpawnInVertOffset ("Vertex Offset Speed", Float) = 10
+ _SpawnInVertOffsetOffset ("vert width", Range(0, 1)) = .1
+ [HideInInspector] m_end_SciFiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_Spawns ("Spawns", Float) = 0
+
+ // Voronoi
+ [HideInInspector] m_start_Voronoi ("Voronoi--{reference_property:_EnableVoronoi}", Float) = 0
+ [Enum(2D(Fast), 0, 3D(Fast with color bugs), 1, 3D(slow but no bugs), 2)] _VoronoiType ("Type", Int) = 1
+ [Enum(Local, 0, World, 1, UV, 2)] _VoronoiSpace ("Space", Int) = 0
+ [Enum(Color and Emission, 0, Just Emission, 1)] _VoronoiBlend ("Blend", Int) = 0
+ [ThryToggle(CHROMATIC_ABERRATION)]_EnableVoronoi ("Enable Voronoi", Float) = 0
+ [ToggleUI]_VoronoiEffectsMaterialAlpha("Effects Material Alpha", Float) = 0
+ _VoronoiMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_VoronoiMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _VoronoiMaskUV ("UV", Int) = 0
+ _VoronoiNoise ("Edge Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_VoronoiNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _VoronoiNoiseUV ("UV", Int) = 0
+ _VoronoiNoiseIntensity ("Noise Intensity", Range(0, 1)) = .1
+ _VoronoiColor0 ("Color 0", Color) = (0, 0, 0, 1)
+ _VoronoiEmission0 ("Emission 0", Range(0, 20)) = 0
+ _VoronoiColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ _VoronoiEmission1 ("Emission 1", Range(0, 20)) = 0
+ [Vector2]_VoronoiGradient ("Gradient", Vector) = (.04, .05, 0, 0)
+ _VoronoiScale ("Scale", Float) = 5
+ [Vector3]_VoronoiSpeed ("Speed", Vector) = (3, 3, 3)
+ [HideInInspector] m_start_voronoiRandom ("Voronoi Random Cell Color--{reference_property:_VoronoiEnableRandomCellColor}", Float) = 0
+ [ToggleUI]_VoronoiEnableRandomCellColor ("Rando Cell Col", Float) = 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_end_Voronoi ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_BlackLight ("Black Light Mask--{reference_property:_BlackLightMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_SPECULARHIGHLIGHTS_OFF)]_BlackLightMaskEnabled ("Black Light Mask Enabled", Float) = 0
+ _BlackLightMaskKeys ("Mask Keys", Vector) = (2, 3, 4, 5)
+ _BlackLightMaskStart ("Gradient Start", Vector) = (0, 0, 0, 0)
+ _BlackLightMaskEnd ("Gradient End", Vector) = (1, 1, 1, 1)
+ [ToggleUI]_BlackLightMaskDebug ("Visualize", Float) = 0
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMetallic ("Metallic", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskClearCoat ("Clear Coat", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap ("Matcap 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap2 ("Matcap 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission ("Emission 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission2 ("Emission 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskFlipbook ("Flipbook", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskDissolve ("Dissolve", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskPanosphere ("Panosphere", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskGlitter ("Glitter", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskIridescence ("Iridescence", Int) = 4
+ [HideInInspector] m_end_BlackLight ("Black Light", Float) = 0
+ // End Patreon
+
+ // Outline Options
+ [HideInInspector] m_outlineOptions ("Outlines", Float) = 0
+ [ToggleUI]_commentIfZero_EnableOutlinePass ("Enable Outlines", float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ _OutlineTintMix ("Tint Mix--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==1}}", Range(0, 1)) = 0
+ _OutlineRimLightBlend ("Rim Light Blend--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==2}}", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==3}}", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==4}}", Vector) = (1, 0, 0, 0)
+ [ToggleUI]_OutlineFixedSize ("Fixed Size?", Float) = 0
+ _OutlinesMaxDistance ("Fixed Size Max Distance", Float) = 9999
+ [Enum(Off, 0, Normals, 1, Mask VC.r, 2)]_OutlineUseVertexColors ("Vertex Color", Float) = 0
+ [ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color", Color) = (1, 1, 1, 1)
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _OutlineTexture ("Outline Texture--{reference_properties:[_OutlineTexturePan, _OutlineTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineTexturePan ("Outline Texture Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _OutlineTextureUV ("UV", Int) = 0
+ _OutlineMask ("Outline Mask--{reference_properties:[_OutlineMaskPan, _OutlineMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _OutlineMaskUV ("UV", Int) = 0
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ [Header(Hue Shift)]
+ [ToggleUI]_OutlineHueShift ("Hue Shift?", Float) = 0
+ _OutlineHueOffset ("Shift", Range(0, 1)) = 0
+ _OutlineHueOffsetSpeed ("Shift Speed", Float) = 0
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ [Vector2]_OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ _OutlineOffsetFactor("Offset Factor", Float) = 0
+ _OutlineOffsetUnits("Offset Units", Float) = 0
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ // Parallax Mapping
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [ThryToggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ [Vector2]_ParallaxHeightMapPan ("Pan", Vector) = (0, 0, 0, 0)
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ParallaxUV ("Parallax UV", Int) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxHeightMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ParallaxHeightMapMaskUV ("UV", Int) = 0
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalMapMask ("Mask", 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
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+ [HideInInspector] m_start_parallaxAdvanced ("Advanced", Float) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_PostProcessing ("Post Processing", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section is designed for you to make adjustments to your final look in game through animations not to permentantly change settings before uploading.", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+
+ [HideInInspector] m_thirdparty ("Third Party", Float) = 0
+ // Raliv
+ [HideInInspector] m_start_raliv ("Raliv Dynamic Penetration System--{button_help:{text:Gumroad,action:{type:URL,data:https://gumroad.com/l/lwthuB},hover:Buy}}", Float) = 0
+ // Penetrator
+ [Helpbox(1)] _RalivHelp ("To use this you'll need to purchase the shader from the gumroad link in the header", Int) = 0
+ [HideInInspector] m_start_ralivPenetrator ("Penetrator--{reference_property:_PenetratorEnabled}", Float) = 0
+ [HideInInspector][ToggleUI] _PenetratorEnabled ("Enabled", Float) = 0
+ _squeeze("Squeeze Minimum Size", Range( 0 , 0.2)) = 0
+ _SqueezeDist("Squeeze Smoothness", Range( 0 , 0.1)) = 0
+ _BulgePower("Bulge Amount", Range( 0 , 0.01)) = 0
+ _BulgeOffset("Bulge Length", Range( 0 , 0.3)) = 0
+ _Length("Length of Penetrator Model", Range( 0 , 3)) = 0
+ _EntranceStiffness("Entrance Stiffness", Range( 0.01 , 1)) = 0.01
+ _Curvature("Curvature", Range( -1 , 1)) = 0
+ _ReCurvature("ReCurvature", Range( -1 , 1)) = 0
+ _Wriggle("Wriggle Amount", Range( 0 , 1)) = 0
+ _WriggleSpeed("Wriggle Speed", Range( 0.1 , 30)) = 0.28
+ [HideInInspector] __dirty( "", Int ) = 1
+ [HideInInspector] m_end_ralivPenetrator ("Penetrator", Float) = 0
+ // Oriface
+ [HideInInspector] m_start_ralivOriface ("Oriface--{reference_property:_OrifaceEnabled}", Float) = 0
+ [HideInInspector][ToggleUI] _OrifaceEnabled ("Enabled", Float) = 0
+ _OrificeData("OrificeData", 2D) = "white" {}
+ _EntryOpenDuration("Entry Trigger Duration", Range( 0 , 1)) = 0.1
+ _Shape1Depth("Shape 1 Trigger Depth", Range( 0 , 5)) = 0.1
+ _Shape1Duration("Shape 1 Trigger Duration", Range( 0 , 1)) = 0.1
+ _Shape2Depth("Shape 2 Trigger Depth", Range( 0 , 5)) = 0.2
+ _Shape2Duration("Shape 2 Trigger Duration", Range( 0 , 1)) = 0.1
+ _Shape3Depth("Shape 3 Trigger Depth", Range( 0 , 5)) = 0.3
+ _Shape3Duration("Shape 3 Trigger Duration", Range( 0 , 1)) = 0.1
+ _BlendshapePower("Blend Shape Power", Range(0,5)) = 1
+ _BlendshapeBadScaleFix("Blend Shape Bad Scale Fix", Range(1,100)) = 1
+ [HideInInspector] m_end_ralivOriface ("Oriface", Float) = 0
+ [HideInInspector] m_start_ralivAdvanced ("Advanced", Float) = 0
+ [Helpbox(1)] _RalivAdvancedHelp ("An advanced user feature that allows a separate channel for penetrators and orifices (think toy radio controlled cars) 0s only interact with 0s and 1s only interact with 1s", Int) = 0
+ _OrificeChannel("OrificeChannel Please Use 0", Float) = 0
+ [HideInInspector] m_end_ralivAdvanced ("Advanced", Float) = 0
+ [HideInInspector] m_end_raliv ("Raliv", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Outline Stencil
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil--{ condition_show:{type:PROPERTY_BOOL,data:_commentIfZero_EnableOutlinePass==1}}", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _OutlineStencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ // Debug Options
+ [HideInInspector] m_start_debugOptions ("Debug", Float) = 0
+ [HideInInspector][ThryToggle(_COLOROVERLAY_ON)]_DebugEnabled ("Display Debug Info", Float) = 0
+ _VertexUnwrap ("Unwrap", Range(0, 1)) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4, Local 0 Distance, 5)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ [HideInInspector] m_end_debugOptions ("Debug", Float) = 0
+ }
+
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry+10" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_BASE_PASS
+ #define FUR
+ float _Mode;
+ // Base Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // Pathing
+ #pragma shader_feature TONEMAPPING_CUSTOM
+ // patreon Base
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ //Audio Link
+ #pragma shader_feature COLOR_GRADING_LOG_VIEW
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Grab Pass Blur
+ #pragma shader_feature CHROMATIC_ABERRATION_LOW
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Touch Color
+ #pragma shader_feature GRAIN
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Emission 1
+ #pragma shader_feature _EMISSION
+ // Emission 2
+ #pragma shader_feature EFFECT_HUE_VARIATION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma geometry geomFur
+
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_ADD_PASS
+ #define FUR
+ float _Mode;
+ // Add Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+ // Pathing
+ #pragma shader_feature TONEMAPPING_CUSTOM
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ //Audio Link
+ #pragma shader_feature COLOR_GRADING_LOG_VIEW
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // Disable Directionals
+ #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
+ // Emission
+ #pragma shader_feature _EMISSION
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma geometry geomFur
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ //EnableOutlinePass
+ Pass
+ {
+ Name "Outline"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ ReadMask [_OutlineStencilReadMask]
+ WriteMask [_OutlineStencilWriteMask]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OutlineOffsetFactor], [_OutlineOffsetUnits]
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ AlphaToMask [_AlphaToMask]
+ Cull [_OutlineCull]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_BASE_PASS
+ #define OUTLINE
+ float _Mode;
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma multi_compile_instancing
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPassOutline.cginc"
+ ENDCG
+
+ }
+ //EnableOutlinePass
+
+ //LightingCastShadows
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ AlphaToMask Off
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define POI_SHADOW
+ float _Mode;
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/CGI_PoiPassShadow.cginc"
+ ENDCG
+
+ }
+ //LightingCastShadows
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+ Cull Off
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define POI_META_PASS
+ float _Mode;
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Emission 1
+ #pragma shader_feature _EMISSION
+ // Emission 2
+ #pragma shader_feature EFFECT_HUE_VARIATION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders/S_Poiyomi_Pro.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders/S_Poiyomi_Pro.shader.meta
new file mode 100644
index 00000000..595b2bfa
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Fur/Pro/Shaders/S_Poiyomi_Pro.shader.meta
@@ -0,0 +1,111 @@
+fileFormatVersion: 2
+guid: 4287dba4d1fb38d44b899145af5fb81a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {fileID: 2800000, guid: a6d6984545cde4a4f9317b17d6dca225, type: 3}
+ - _BumpMap: {instanceID: 0}
+ - _ClippingMask: {instanceID: 0}
+ - _MainColorAdjustTexture: {instanceID: 0}
+ - _RGBMask: {instanceID: 0}
+ - _RedTexure: {instanceID: 0}
+ - _GreenTexture: {instanceID: 0}
+ - _BlueTexture: {instanceID: 0}
+ - _RgbNormalR: {instanceID: 0}
+ - _RgbNormalG: {instanceID: 0}
+ - _RgbNormalB: {instanceID: 0}
+ - _DetailMask: {instanceID: 0}
+ - _DetailTex: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _VertexManipulationHeightMask: {instanceID: 0}
+ - _DecalTexture: {instanceID: 0}
+ - _DecalMask: {instanceID: 0}
+ - _BackFaceTexture: {instanceID: 0}
+ - _1st_ShadeMap: {instanceID: 0}
+ - _2nd_ShadeMap: {instanceID: 0}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ - _LightingShadowMask: {instanceID: 0}
+ - _LightingDetailShadows: {instanceID: 0}
+ - _LightingAOTex: {instanceID: 0}
+ - _SSSThicknessMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ - _RimMask: {instanceID: 0}
+ - _RimWidthNoiseTexture: {instanceID: 0}
+ - _RimEnviroMask: {instanceID: 0}
+ - _BRDFMetallicGlossMap: {instanceID: 0}
+ - _BRDFSpecularMap: {instanceID: 0}
+ - _BRDFMetallicMap: {instanceID: 0}
+ - _BRDFFallback: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ - _CubeMap: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ - _MetallicTintMap: {instanceID: 0}
+ - _MetallicMask: {instanceID: 0}
+ - _SmoothnessMask: {instanceID: 0}
+ - _ClearCoatCubeMap: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ - _ClearCoatMask: {instanceID: 0}
+ - _ClearCoatSmoothnessMap: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMask: {instanceID: 0}
+ - _Matcap2: {instanceID: 0}
+ - _Matcap2Mask: {instanceID: 0}
+ - _SpecularMetallicMap: {instanceID: 0}
+ - _SpecularMap: {instanceID: 0}
+ - _SpecularMask: {instanceID: 0}
+ - _AnisoTangentMap: {instanceID: 0}
+ - _SpecularAnisoJitterMicro: {instanceID: 0}
+ - _SpecularAnisoJitterMacro: {instanceID: 0}
+ - _SpecularMetallicMap1: {instanceID: 0}
+ - _SpecularMap1: {instanceID: 0}
+ - _SpecularMask1: {instanceID: 0}
+ - _AnisoTangentMap1: {instanceID: 0}
+ - _SpecularAnisoJitterMicro1: {instanceID: 0}
+ - _SpecularAnisoJitterMacro1: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _EmissionScrollingCurve: {instanceID: 0}
+ - _EmissionMap1: {instanceID: 0}
+ - _EmissionMask1: {instanceID: 0}
+ - _EmissionScrollingCurve1: {instanceID: 0}
+ - _FlipbookTexArray: {instanceID: 0}
+ - _FlipbookMask: {instanceID: 0}
+ - _DissolveEdgeGradient: {instanceID: 0}
+ - _DissolveToTexture: {instanceID: 0}
+ - _DissolveNoiseTexture: {instanceID: 0}
+ - _DissolveDetailNoise: {instanceID: 0}
+ - _DissolveMask: {instanceID: 0}
+ - _PanosphereTexture: {instanceID: 0}
+ - _PanoMask: {instanceID: 0}
+ - _PanoCubeMap: {instanceID: 0}
+ - _GlitterColorMap: {instanceID: 0}
+ - _GlitterMask: {instanceID: 0}
+ - _GlitterTexture: {instanceID: 0}
+ - _TextGlyphs: {instanceID: 0}
+ - _MirrorTexture: {instanceID: 0}
+ - _MainFadeTexture: {instanceID: 0}
+ - _DistortionMask: {instanceID: 0}
+ - _DistortionFlowTexture: {instanceID: 0}
+ - _DistortionFlowTexture1: {instanceID: 0}
+ - _VideoPixelTexture: {instanceID: 0}
+ - _VideoMaskTexture: {instanceID: 0}
+ - _VideoDebugTexture: {instanceID: 0}
+ - _VideoGameboyRamp: {instanceID: 0}
+ - _BulgeMask: {instanceID: 0}
+ - _DepthGradient: {instanceID: 0}
+ - _DepthMask: {instanceID: 0}
+ - _HoloAlphaMap: {instanceID: 0}
+ - _GrabPassBlendMap: {instanceID: 0}
+ - _IridescenceRamp: {instanceID: 0}
+ - _IridescenceNormalMap: {instanceID: 0}
+ - _IridescenceMask: {instanceID: 0}
+ - _SpawnInNoise: {instanceID: 0}
+ - _VoronoiMask: {instanceID: 0}
+ - _VoronoiNoise: {instanceID: 0}
+ - _OutlineTexture: {instanceID: 0}
+ - _OutlineMask: {instanceID: 0}
+ - _ParallaxHeightMap: {instanceID: 0}
+ - _ParallaxHeightMapMask: {instanceID: 0}
+ - _ParallaxInternalMap: {instanceID: 0}
+ - _ParallaxInternalMapMask: {instanceID: 0}
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles.meta
new file mode 100644
index 00000000..68cf7876
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ad188b53e9df9a94cbb4946dfe8d1e02
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders.meta
new file mode 100644
index 00000000..418f945f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5b46cd018e07ddd4dbffd6b162ff9ec6
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes.meta
new file mode 100644
index 00000000..934eb57a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8b63d42191c5daa458a8cae16169460d
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiClearCoat.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiClearCoat.cginc
new file mode 100644
index 00000000..74814754
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiClearCoat.cginc
@@ -0,0 +1,78 @@
+#ifndef POI_CLEARCOAT
+ #define POI_CLEARCOAT
+
+ samplerCUBE _ClearCoatCubeMap;
+ float _ClearCoatSampleWorld;
+ sampler2D _ClearCoatMask; float4 _ClearCoatMask_ST;
+ sampler2D _ClearCoatSmoothnessMask; float4 _ClearCoatSmoothnessMask_ST;
+ float _ClearCoatInvertSmoothness;
+ float _ClearCoat;
+ float _ClearCoatSmoothness;
+ float3 _ClearCoatTint;
+ uint _ClearCoatNormalToUse;
+
+ float lighty_clear_boy_uwu_var;
+ half3 calculateClearCoatRelfection()
+ {
+ float _Smoothness_map_var = (tex2D(_ClearCoatSmoothnessMask, TRANSFORM_TEX(poiMesh.uv[0], _ClearCoatSmoothnessMask)));
+ if (_ClearCoatInvertSmoothness == 1)
+ {
+ _Smoothness_map_var = 1 - _Smoothness_map_var;
+ }
+ _Smoothness_map_var *= _ClearCoatSmoothness;
+ half roughness = 1 - _Smoothness_map_var;
+ roughness *= 1.7 - 0.7 * roughness;
+ float3 reflectedDir = _ClearCoatNormalToUse == 0 ? poiCam.vertexReflectionDir : poiCam.reflectionDir;
+
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ half3 reflection = 0;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ //Probe 1
+ float4 reflectionData0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 reflectionColor0 = DecodeHDR(reflectionData0, unity_SpecCube0_HDR);
+
+ //Probe 2
+ float4 reflectionData1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 reflectionColor1 = DecodeHDR(reflectionData1, unity_SpecCube1_HDR);
+
+ reflection = lerp(reflectionColor1, reflectionColor0, interpolator);
+ }
+ else
+ {
+ float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ reflection = DecodeHDR(reflectionData, unity_SpecCube0_HDR);
+ }
+
+ bool no_probe = unity_SpecCube0_HDR.a == 0 && envSample.a == 0;
+ lighty_clear_boy_uwu_var = 0;
+ if (no_probe || _ClearCoatSampleWorld)
+ {
+ lighty_clear_boy_uwu_var = 1;
+ reflection = texCUBElod(_ClearCoatCubeMap, float4(reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ }
+
+ half3 finalreflection = reflection.rgb * _ClearCoatTint;
+
+ return finalreflection;
+ }
+
+ void calculateAndApplyClearCoat(inout float4 finalColor)
+ {
+ half clearCoatMap = tex2D(_ClearCoatMask, TRANSFORM_TEX(poiMesh.uv[0], _ClearCoatMask));
+ half3 reflectionColor = calculateClearCoatRelfection();
+
+ float NormalDotView = abs(dot(_ClearCoat,_ClearCoatNormalToUse == 0 ? poiLight.vNDotV : poiLight.nDotV).r);
+ #ifdef POI_LIGHTING
+ finalColor.rgb = lerp(finalColor.rgb, reflectionColor * lerp(1, poiLight.finalLighting, lighty_clear_boy_uwu_var), clearCoatMap * _ClearCoat * clamp(FresnelTerm(_ClearCoat, NormalDotView),0,1));
+ //finalColor.rgb += reflectionColor;
+ //finalColor.rgb = finalColor.rgb * (1- (reflectionColor.r + reflectionColor.g + reflectionColor.b)/3) + reflectionColor * clearCoatMap * lerp(1, poiLight.finalLighting, lighty_clear_boy_uwu_var);
+ #else
+ lerp(finalColor.rgb, reflectionColor, clearCoatMap * _ClearCoat * clamp(FresnelTerm(_ClearCoat, NormalDotView),0,1));
+ #endif
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiClearCoat.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiClearCoat.cginc.meta
new file mode 100644
index 00000000..78c227c2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiClearCoat.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bd79ef0bdcffc3c408f6526743865acf
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiData.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiData.cginc
new file mode 100644
index 00000000..dade3f96
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiData.cginc
@@ -0,0 +1,104 @@
+#ifndef POI_DATA
+ #define POI_DATA
+
+ float FadeShadows(float attenuation, float3 worldPosition)
+ {
+ float viewZ = dot(_WorldSpaceCameraPos - worldPosition, UNITY_MATRIX_V[2].xyz);
+ float shadowFadeDistance = UnityComputeShadowFadeDistance(worldPosition, viewZ);
+ float shadowFade = UnityComputeShadowFade(shadowFadeDistance);
+ attenuation = saturate(attenuation + shadowFade);
+ return attenuation;
+ }
+
+ void calculateAttenuation(v2f i)
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz)
+ poiLight.attenuation = FadeShadows(attenuation, i.worldPos.xyz);
+ }
+
+ void calculateLightDirection(v2f i)
+ {
+ #ifdef FORWARD_BASE_PASS
+ poiLight.direction = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos);
+ #endif
+ #endif
+ }
+
+ void calculateLightColor()
+ {
+ #ifdef FORWARD_BASE_PASS
+ //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 magic = saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 normalLight = saturate(_LightColor0.rgb);
+ poiLight.color = saturate(magic + normalLight);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.color = _LightColor0.rgb;
+ #endif
+ #endif
+ }
+
+ float3 CreateBinormal(float3 normal, float3 tangent, float binormalSign)
+ {
+ return cross(normal, tangent.xyz) * (binormalSign * unity_WorldTransformParams.w);
+ }
+
+ void InitializeMeshData(inout v2f i)
+ {
+ poiMesh.vertexNormal = i.normal;
+ poiMesh.bitangent = i.bitangent;
+ poiMesh.tangent = i.tangent;
+ poiMesh.worldPos = i.worldPos;
+ poiMesh.localPos = i.localPos;
+ poiMesh.uv[0] = i.uv0;
+ poiMesh.uv[1] = i.uv1;
+ poiMesh.uv[2] = i.uv2;
+ poiMesh.uv[3] = i.uv3;
+ poiMesh.modelPos = i.modelPos;
+ }
+
+ void initializeCamera(v2f i)
+ {
+ poiCam.viewDir = normalize(_WorldSpaceCameraPos - i.worldPos);
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.tangentViewDir = normalize(i.tangentViewDir);
+ poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ }
+
+ void calculateTangentData()
+ {
+ poiTData. tangentTransform = float3x3(poiMesh.tangent, poiMesh.bitangent, poiMesh.vertexNormal);
+ poiTData.tangentToWorld = transpose(float3x3(poiMesh.tangent, poiMesh.bitangent, poiMesh.vertexNormal));
+ }
+
+ void InitData(inout v2f i)
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+
+ calculateAttenuation(i);
+ calculateLightColor();
+ #if defined(VERTEXLIGHT_ON)
+ poiLight.vertexLightColor = i.vertexLightColor;
+ #endif
+ calculateLightDirection(i);
+
+ InitializeMeshData(i);
+ initializeCamera(i);
+ calculateTangentData();
+
+ poiLight.halfDir = Unity_SafeNormalize(poiLight.direction + poiCam.viewDir);
+ }
+
+ void CalculateReflectionData()
+ {
+ #if defined(_METALLICGLOSSMAP) || defined(_COLORCOLOR_ON)
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.fragmentNormal);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.vertexNormal);
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiData.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiData.cginc.meta
new file mode 100644
index 00000000..fcef5adb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiData.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a045b25b0c6f7a14d92617f3adb89f8a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDebug.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDebug.cginc
new file mode 100644
index 00000000..49f32de7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDebug.cginc
@@ -0,0 +1,123 @@
+#ifndef POI_DEBUG
+ #define POI_DEBUG
+
+ float _DebugDisplayDebug;
+ uint _DebugMeshData;
+ uint _DebugLightingData;
+ uint _DebugSpecularData;
+ uint _DebugCameraData;
+
+ void displayDebugInfo(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if (_DebugDisplayDebug != 0)
+ {
+ //Mesh Data
+ if (_DebugMeshData == 1)
+ {
+ finalColor.rgb = poiMesh.vertexNormal;
+ return;
+ }
+ else if(_DebugMeshData == 2)
+ {
+ finalColor.rgb = poiMesh.fragmentNormal;
+ return;
+ }
+ else if(_DebugMeshData == 3)
+ {
+ finalColor.rgb = poiMesh.tangent;
+ return;
+ }
+ else if(_DebugMeshData == 4)
+ {
+ finalColor.rgb = poiMesh.bitangent;
+ return;
+ }
+
+ #ifdef POI_LIGHTING
+ // Lighting
+ if (_DebugLightingData == 1)
+ {
+ finalColor.rgb = poiLight.attenuation;
+ return;
+ }
+ else if(_DebugLightingData == 2)
+ {
+ finalColor.rgb = poiLight.directLighting;
+ return;
+ }
+ else if(_DebugLightingData == 3)
+ {
+ finalColor.rgb = poiLight.indirectLighting;
+ return;
+ }
+ else if(_DebugLightingData == 4)
+ {
+ finalColor.rgb = poiLight.lightMap;
+ return;
+ }
+ else if(_DebugLightingData == 5)
+ {
+ finalColor.rgb = poiLight.rampedLightMap;
+ return;
+ }
+ else if(_DebugLightingData == 6)
+ {
+ finalColor.rgb = poiLight.finalLighting;
+ return;
+ }
+ else if(_DebugLightingData == 7)
+ {
+ finalColor.rgb = poiLight.nDotL;
+ return;
+ }
+ #endif
+
+ #ifdef POI_SPECULAR
+ //specular
+ if (_DebugSpecularData == 1)
+ {
+ finalColor.rgb = finalSpecular;
+ return;
+ }
+ else if(_DebugSpecularData == 2)
+ {
+ finalColor.rgb = tangentDirectionMap;
+ return;
+ }
+ else if(_DebugSpecularData == 3)
+ {
+ finalColor.rgb = shiftTexture;
+ return;
+ }
+ #endif
+
+ if(_DebugCameraData == 1)
+ {
+ finalColor.rgb = poiCam.viewDir;
+ return;
+ }
+ else if(_DebugCameraData == 2)
+ {
+ finalColor.rgb = poiCam.tangentViewDir;
+ return;
+ }
+ else if(_DebugCameraData == 3)
+ {
+ finalColor.rgb = poiCam.forwardDir;
+ return;
+ }
+ else if(_DebugCameraData == 4)
+ {
+ finalColor.rgb = poiCam.worldPos;
+ return;
+ }
+ else if(_DebugCameraData == 5)
+ {
+ finalColor.rgb = poiCam.viewDotNormal;
+ return;
+ }
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDebug.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDebug.cginc.meta
new file mode 100644
index 00000000..edd99708
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDebug.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c06042e6fcc80524184098c8c337d001
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDissolve.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDissolve.cginc
new file mode 100644
index 00000000..3480ac5b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDissolve.cginc
@@ -0,0 +1,200 @@
+#ifndef POI_DISSOLVE
+ #define POI_DISSOLVE
+
+ uint _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient; float4 _DissolveEdgeGradient_ST;
+ float _DissolveEdgeEmission;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DissolveMask); float4 _DissolveMask_ST;
+ float4 _DissolveTextureColor;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DissolveToTexture); float4 _DissolveToTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DissolveNoiseTexture); float4 _DissolveNoiseTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DissolveDetailNoise); float4 _DissolveDetailNoise_ST;
+ float4 _DissolvePan;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+ float4 _DissolveToPanning;
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ uint _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+ //Globals
+ #ifndef POISHADOW
+ void calculateDissolve()
+ {
+ float dissolveMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DissolveMask)).r;
+ dissolveToTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveToTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DissolveToTexture) + _Time.y * _DissolveToPanning.xy) * _DissolveTextureColor;
+ float dissolveNoiseTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveNoiseTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DissolveNoiseTexture) + _Time.y * _DissolvePan.xy);
+ float dissolveDetailNoise = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveDetailNoise, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DissolveDetailNoise) + _Time.y * _DissolvePan.zw);
+
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if(_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if(_ContinuousDissolve != 0)
+ {
+ _DissolveAlpha = sin(_Time.y * _ContinuousDissolve) * .5 + .5;
+ }
+ _DissolveAlpha *= dissolveMask;
+ dissolveAlpha = _DissolveAlpha;
+ edgeAlpha = 0;
+
+ UNITY_BRANCH
+ if(_DissolveType == 1) // Basic
+ {
+ _DissolveAlpha = remap(_DissolveAlpha, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = _DissolveAlpha;
+ //Adjust detail strength to avoid artifacts
+ _DissolveDetailStrength *= smoothstep(1, .99, _DissolveAlpha);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * _DissolveDetailStrength);
+
+ noise = saturate(noise + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(noise, _DissolveAlpha + _DissolveEdgeWidth, _DissolveAlpha, 0, 1) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 2) // Point to Point
+ {
+ float3 direction;
+ float3 currentPos;
+ float distanceTo = 0;
+ direction = normalize(_DissolveEndPoint - _DissolveStartPoint);
+ currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha);
+ if (_DissolveP2PWorldLocal == 0)
+ {
+ distanceTo = dot(poiMesh.localPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ mainTexture = lerp(mainTexture, dissolveToTexture, dissolveAlpha);
+
+ if(_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, TRANSFORM_TEX(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient)) * _DissolveEdgeColor;
+ mainTexture.rgb = lerp(mainTexture.rgb, edgeColor.rgb, remapClamped(edgeAlpha, 0, 1 - _DissolveEdgeHardness, 0, 1));
+ }
+
+
+
+
+ /*
+ UNITY_BRANCH
+ if (_Blend != 0)
+ {
+ float blendNoise = tex2D(_BlendNoiseTexture, TRANSFORM_TEX(uv, _BlendNoiseTexture));
+ blendAlpha = _BlendAlpha;
+ if(_AutoBlend > 0)
+ {
+ blendAlpha = (clamp(sin(_Time.y * _AutoBlendSpeed / _AutoBlendDelay) * (_AutoBlendDelay + 1), -1, 1) + 1) / 2;
+ }
+ blendAlpha = lerp(saturate((blendNoise - 1) + blendAlpha * 2), step((1-blendAlpha) * 1.001, blendNoise), _Blend - 1);
+
+ float4 blendCol = tex2D(_BlendTexture, TRANSFORM_TEX(uv, _BlendTexture)) * _BlendTextureColor;
+ diffuse = lerp(diffuse, blendCol, blendAlpha);
+ mainTexture.a = lerp(mainTexture.a, blendCol.a, blendAlpha);
+ }
+ */
+ }
+
+ void applyDissolveEmission(inout float4 finalColor)
+ {
+ finalColor += lerp(0, dissolveToTexture * _DissolveToEmissionStrength, dissolveAlpha) * albedo.a;
+ finalColor.rgb += lerp(0, edgeColor.rgb * _DissolveEdgeEmission, remapClamped(edgeAlpha, 0, 1 - _DissolveEdgeHardness, 0, 1)) * albedo.a;
+ }
+
+ #endif
+
+ float calculateShadowDissolveAlpha(float3 worldPos, float3 localPos, float2 uv)
+ {
+ float dissolveMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveMask, _MainTex, TRANSFORM_TEX(uv, _DissolveMask)).r;
+ dissolveToTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveToTexture, _MainTex, TRANSFORM_TEX(uv, _DissolveToTexture) + _Time.y * _DissolveToPanning.xy) * _DissolveTextureColor;
+ float dissolveNoiseTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveNoiseTexture, _MainTex, TRANSFORM_TEX(uv, _DissolveNoiseTexture) + _Time.y * _DissolvePan.xy);
+ float dissolveDetailNoise = UNITY_SAMPLE_TEX2D_SAMPLER(_DissolveDetailNoise, _MainTex, TRANSFORM_TEX(uv, _DissolveDetailNoise) + _Time.y * _DissolvePan.zw);
+
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if(_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if(_ContinuousDissolve != 0)
+ {
+ _DissolveAlpha = sin(_Time.y * _ContinuousDissolve) * .5 + .5;
+ }
+ _DissolveAlpha *= dissolveMask;
+ dissolveAlpha = _DissolveAlpha;
+ edgeAlpha = 0;
+
+ UNITY_BRANCH
+ if(_DissolveType == 1) // Basic
+ {
+ _DissolveAlpha = remap(_DissolveAlpha, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = _DissolveAlpha;
+ //Adjust detail strength to avoid artifacts
+ _DissolveDetailStrength *= smoothstep(1, .99, _DissolveAlpha);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * _DissolveDetailStrength);
+
+ noise = saturate(noise + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(noise, _DissolveAlpha + _DissolveEdgeWidth, _DissolveAlpha, 0, 1) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 2) // Point to Point
+ {
+ float3 direction;
+ float3 currentPos;
+ float distanceTo = 0;
+ direction = normalize(_DissolveEndPoint - _DissolveStartPoint);
+ currentPos = lerp(_DissolveStartPoint, _DissolveEndPoint, dissolveAlpha);
+ if (_DissolveP2PWorldLocal == 0)
+ {
+ distanceTo = dot(localPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ dissolveAlpha = step(distanceTo, 0);
+ }
+ else
+ {
+ distanceTo = dot(worldPos - currentPos, direction) - dissolveDetailNoise * _DissolveDetailStrength;
+ dissolveAlpha = step(distanceTo, 0);
+ }
+ }
+
+ return lerp(1, dissolveToTexture, dissolveAlpha).a;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDissolve.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDissolve.cginc.meta
new file mode 100644
index 00000000..d12d8fba
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDissolve.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bf36262bf410e4b4ea5f93bbd85e81e2
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDragNDropLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDragNDropLighting.cginc
new file mode 100644
index 00000000..3846f604
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDragNDropLighting.cginc
@@ -0,0 +1,100 @@
+#ifndef DND_LIGHTING
+ #define DND_LIGHTING
+
+ sampler2D _ToonRamp;
+ float _AdditiveSoftness;
+ float _AdditiveOffset;
+ float _ForceLightDirection;
+ float _ShadowStrength;
+ float _OutlineShadowStrength;
+ float _ShadowOffset;
+ float3 _LightDirection;
+ float _ForceShadowStrength;
+ float _CastedShadowSmoothing;
+ float _MinBrightness;
+ float _MaxBrightness;
+ float _IndirectContribution;
+ float _AttenuationMultiplier;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_AOMap); float4 _AOMap_ST;
+ float _AOStrength;
+
+ float3 ShadeSH9Indirect()
+ {
+ return ShadeSH9(half4(0.0, -1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Direct()
+ {
+ return ShadeSH9(half4(0.0, 1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Normal(float3 normalDirection)
+ {
+ return ShadeSH9(half4(normalDirection, 1.0));
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ x1.b = length(unity_SHBb);
+ return x + x1;
+ }
+
+ float FadeShadows(float attenuation, float3 worldPosition)
+ {
+ float viewZ = dot(_WorldSpaceCameraPos - worldPosition, UNITY_MATRIX_V[2].xyz);
+ float shadowFadeDistance = UnityComputeShadowFadeDistance(worldPosition, viewZ);
+ float shadowFade = UnityComputeShadowFade(shadowFadeDistance);
+ attenuation = saturate(attenuation + shadowFade);
+ return attenuation;
+ }
+
+ float calculateAOMap(float AOMap, float AOStrength)
+ {
+ return lerp(1, AOMap, AOStrength);
+ }
+
+ void calculateBasePassLighting(float3 normal, float2 uv)
+ {
+ poiLight.direction = _WorldSpaceLightPos0;
+ poiLight.nDotL = dot(normal, poiLight.direction);
+ float AOMap = 1;
+ #ifndef OUTLINE
+ AOMap = UNITY_SAMPLE_TEX2D_SAMPLER(_AOMap, _MainTex, TRANSFORM_TEX(uv, _AOMap));
+ AOMap = calculateAOMap(AOMap, _AOStrength);
+ #endif
+ poiLight.finalLighting = saturate((GetSHLength() + poiLight.color) * AOMap);
+ }
+
+ void calculateDNDLighting(v2f i)
+ {
+ #ifdef OUTLINE
+ _ShadowStrength = _OutlineShadowStrength;
+ #endif
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz)
+ poiLight.attenuation = FadeShadows(attenuation, i.worldPos.xyz);
+ poiLight.color = _LightColor0.rgb;
+ #ifdef FORWARD_BASE_PASS
+ calculateBasePassLighting(poiMesh.fragmentNormal, i.uv);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.position = _WorldSpaceLightPos0.xyz;
+ poiLight.direction = normalize(poiLight.position - i.worldPos);
+ poiLight.nDotL = dot(poiMesh.fragmentNormal, poiLight.direction);
+ poiLight.finalLighting = poiLight.color * poiLight.attenuation * smoothstep(.499, .5, .5 * poiLight.nDotL + .5);
+ #endif
+ #endif
+ }
+
+ void applyDNDLighting(inout float4 finalColor)
+ {
+ finalColor.rgb *= poiLight.finalLighting;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDragNDropLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDragNDropLighting.cginc.meta
new file mode 100644
index 00000000..18385131
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiDragNDropLighting.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b1c2ff5cc02c3dc428a5b629842d4d87
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiEmission.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiEmission.cginc
new file mode 100644
index 00000000..c03f7a71
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiEmission.cginc
@@ -0,0 +1,74 @@
+#ifndef POI_EMISSION
+ #define POI_EMISSION
+
+ float4 _EmissionColor;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionMap); float4 _EmissionMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionMask); float4 _EmissionMask_ST;
+ float _EmissionStrength;
+ float _EnableEmission;
+ float4 _EmissiveScroll_Direction;
+ float4 _EmissionPan;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _ScrollingEmission;
+ float _EnableGITDEmission;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ uint _GITDEWorldOrMesh;
+ uint _EmissionMapUV;
+ float4 emission = 0;
+
+ void calculateEmission()
+ {
+ #ifdef POI_LIGHTING
+ UNITY_BRANCH
+ if (_EnableGITDEmission != 0)
+ {
+ float3 lightValue = _GITDEWorldOrMesh ? poiLight.finalLighting.rgb: poiLight.directLighting.rgb;
+ float gitdeAlpha = (clamp(poiMax(lightValue), _GITDEMinLight, _GITDEMaxLight) - _GITDEMinLight) / (_GITDEMaxLight - _GITDEMinLight);
+ _EmissionStrength *= lerp(_GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, gitdeAlpha);
+ }
+ #endif
+
+ float4 _Emissive_Tex_var = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMapUV], _EmissionMap) + _Time.y * _EmissionPan.xy);
+ emission = _Emissive_Tex_var * _EmissionColor * _EmissionStrength;
+
+ // scrolling emission
+ if (_ScrollingEmission == 1)
+ {
+ float phase = dot(poiMesh.localPos, _EmissiveScroll_Direction);
+ phase -= _Time.y * _EmissiveScroll_Velocity;
+ phase /= _EmissiveScroll_Interval;
+ phase -= floor(phase);
+ float width = _EmissiveScroll_Width;
+ phase = (pow(phase, width) + pow(1 - phase, width * 4)) * 0.5;
+ emission *= phase;
+ }
+
+ // blinking emission
+ float amplitude = (_EmissiveBlink_Max - _EmissiveBlink_Min) * 0.5f;
+ float base = _EmissiveBlink_Min + amplitude;
+ float emissiveBlink = sin(_Time.y * _EmissiveBlink_Velocity) * amplitude + base;
+ emission *= emissiveBlink;
+
+ float _Emission_mask_var = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMapUV], _EmissionMask) + _Time.x * _EmissionPan.zw);
+
+
+
+ emission *= _Emission_mask_var;
+ }
+ void applyEmission(inout float4 finalColor)
+ {
+ #ifdef TRANSPARENT
+ finalColor.rgb += emission * albedo.a;
+ #else
+ finalColor.rgb += emission;
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiEmission.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiEmission.cginc.meta
new file mode 100644
index 00000000..cb667c13
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiEmission.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3873d90815bcb9544bd9f7a82149bcb3
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFlipbook.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFlipbook.cginc
new file mode 100644
index 00000000..763568dc
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFlipbook.cginc
@@ -0,0 +1,70 @@
+#ifndef FLIPBOOK
+ #define FLIPBOOK
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST;
+ float4 _FlipbookColor;
+ float _FlipbookFPS;
+ uint _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float _FlipbookTiled;
+ int _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ uint _FlipbookUV;
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ // anim
+ uint _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Global
+ float4 flipBookPixel;
+ float4 flipBookPixelMultiply;
+ void calculateFlipbook()
+ {
+ _FlipbookScaleOffset.xy = 1 - _FlipbookScaleOffset.xy;
+ float2 uv = poiMesh.uv[_FlipbookUV];
+ float theta = radians(_FlipbookRotation);
+
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = _FlipbookScaleOffset.zw + .5;
+ 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);
+
+ float2 newUV = remap(uv, float2(0, 0) + _FlipbookScaleOffset.xy / 2 + _FlipbookScaleOffset.zw, float2(1, 1) - _FlipbookScaleOffset.xy / 2 + _FlipbookScaleOffset.zw, float2(0, 0), float2(1, 1));
+
+ UNITY_BRANCH
+ if (_FlipbookTiled == 0)
+ {
+ if(max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ flipBookPixel = 0;
+ flipBookPixelMultiply = 1;
+ return;
+ }
+ }
+
+ uint currentFrame = floor(_FlipbookCurrentFrame) % _FlipbookTotalFrames;
+ if(_FlipbookCurrentFrame < 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray), currentFrame));
+ flipBookPixelMultiply = flipBookPixel;
+ }
+ void applyFlipbook(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor, flipBookPixel.rgb * _FlipbookColor.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace);
+ finalColor.rgb = finalColor + flipBookPixel.rgb * _FlipbookColor.rgb * _FlipbookAdd;
+ finalColor.rgb = finalColor * lerp(1, flipBookPixelMultiply.rgb * _FlipbookColor.rgb, _FlipbookMultiply * flipBookPixelMultiply.a * _FlipbookColor.a);
+ }
+ void applyFlipbookEmission(inout float4 finalColor)
+ {
+ finalColor.rgb += lerp(0, flipBookPixel.rgb * _FlipbookColor.rgb * _FlipbookEmissionStrength, flipBookPixel.a * _FlipbookColor.a);
+ }
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFlipbook.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFlipbook.cginc.meta
new file mode 100644
index 00000000..b2954626
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFlipbook.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bc640e1037c35a549a2b3367efe4563e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFrag.cginc
new file mode 100644
index 00000000..02635c88
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFrag.cginc
@@ -0,0 +1,196 @@
+#ifndef POIFRAG
+ #define POIFRAG
+
+ float _ForceOpaque;
+ float4 _GlobalPanSpeed;
+ float _Clip;
+ float _MainEmissionStrength;
+
+ float4 frag(v2f i, float facing: VFACE): SV_Target
+ {
+
+ i.uv0 += _GlobalPanSpeed.xy * _Time.x;
+ //This has to be first because it modifies the UVs for the rest of the functions
+
+ #ifdef POI_DATA
+ InitData(i);
+ #endif
+
+ // This has to happen in init because it alters UV data globally
+ #ifdef POI_PARALLAX
+ calculateandApplyParallax(i);
+ #endif
+
+ #ifdef POI_MAINTEXTURE
+ initTextureData();
+ #endif
+
+ #ifdef REFRACTION
+ calculateRefraction(i);
+ #endif
+
+ #ifdef POI_LIGHTING
+ calculateLighting();
+ #endif
+
+ #if defined(POI_METAL) || defined(POI_CLEARCOAT)
+ CalculateReflectionData();
+ #endif
+
+ #ifdef POI_METAL
+ calculateReflections();
+ #endif
+
+ #ifdef POI_DATA
+ distanceFade();
+ #endif
+
+ #ifdef POI_RANDOM
+ albedo.a *= i.angleAlpha;
+ #endif
+
+ clip(albedo.a - _Clip);
+
+ #ifdef MATCAP
+ calculateMatcap();
+ #endif
+
+ #ifdef FLIPBOOK
+ calculateFlipbook();
+ #endif
+
+ #ifdef POI_LIGHTING
+ #ifdef SUBSURFACE
+ calculateSubsurfaceScattering();
+ #endif
+ #endif
+
+ #ifdef POI_RIM
+ calculateRimLighting();
+ #endif
+
+ #ifdef PANOSPHERE
+ calculatePanosphere();
+ #endif
+
+ #ifdef POI_EMISSION
+ calculateEmission();
+ #endif
+
+ finalColor = albedo;
+
+ #ifdef REFRACTION
+ applyRefraction(finalColor);
+ #endif
+
+ #ifdef POI_RIM
+ applyRimColor(finalColor);
+ #endif
+
+ #ifdef MATCAP
+ applyMatcap(finalColor);
+ #endif
+
+ #ifdef PANOSPHERE
+ applyPanosphereColor(finalColor);
+ #endif
+
+ #ifdef FLIPBOOK
+ applyFlipbook(finalColor);
+ #endif
+
+ float4 finalColorBeforeLighting = finalColor;
+
+ #ifdef POI_LIGHTING
+ applyLighting(finalColor);
+ #endif
+
+ #ifdef POI_RIM
+ applyEnviroRim(finalColor);
+ #endif
+
+ #ifdef POI_METAL
+ applyReflections(finalColor, finalColorBeforeLighting);
+ #endif
+
+ #ifdef POI_SPECULAR
+ calculateSpecular(finalColorBeforeLighting);
+ #endif
+
+ #ifdef POI_PARALLAX
+ calculateAndApplyInternalParallax();
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ #ifdef POI_LIGHTING
+ #ifdef POI_SPECULAR
+ //applyLightingToSpecular();
+ applySpecular(finalColor);
+ #endif
+ #endif
+
+ finalColor.rgb += albedo.rgb * _MainEmissionStrength * albedo.a;
+
+ #ifdef PANOSPHERE
+ applyPanosphereEmission(finalColor);
+ #endif
+
+ #ifdef POI_EMISSION
+ applyEmission(finalColor);
+ #endif
+
+ #ifdef POI_DISSOLVE
+ applyDissolveEmission(finalColor);
+ #endif
+
+ #ifdef POI_RIM
+ ApplyRimEmission(finalColor);
+ #endif
+
+ #endif
+
+ #ifdef POI_LIGHTING
+ #if (defined(POINT) || defined(SPOT))
+ #ifdef POI_METAL
+ applyAdditiveReflectiveLighting(finalColor);
+ #endif
+ #ifdef TRANSPARENT
+ finalColor.rgb *= finalColor.a;
+ #endif
+
+ #ifdef POI_SPECULAR
+ applySpecular(finalColor);
+ #endif
+ #endif
+ #endif
+
+ #ifdef POI_LIGHTING
+ #ifdef SUBSURFACE
+ applySubsurfaceScattering(finalColor);
+ #endif
+ #endif
+
+ #ifdef FLIPBOOK
+ applyFlipbookEmission(finalColor);
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_APPLY_FOG(i.fogCoord, finalColor);
+ #endif
+
+
+ finalColor.a = max(_ForceOpaque, finalColor.a);
+
+ #ifdef FORWARD_BASE_PASS
+ #ifdef POI_CLEARCOAT
+ calculateAndApplyClearCoat(finalColor);
+ #endif
+ #endif
+
+ #ifdef POI_DEBUG
+ displayDebugInfo(finalColor);
+ #endif
+
+ return finalColor;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFrag.cginc.meta
new file mode 100644
index 00000000..07d6d922
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiFrag.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 275146360015da849b7d770865ece1f0
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiGeom.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiGeom.cginc
new file mode 100644
index 00000000..a1d2e5d5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiGeom.cginc
@@ -0,0 +1,10 @@
+[maxvertexcount(3)]
+void geom(triangle v2f IN[3], inout TriangleStream < v2f > tristream)
+{
+ for (int i = 0; i < 3; i ++)
+ {
+ IN[i].uv = uv;
+ tristream.Append(IN[i]);
+ }
+ tristream.RestartStrip();
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiGeom.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiGeom.cginc.meta
new file mode 100644
index 00000000..3afa1bc4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiGeom.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5ffd7b31944cb5d40bb4bb1d6373b4be
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiHelpers.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiHelpers.cginc
new file mode 100644
index 00000000..ca97c16b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiHelpers.cginc
@@ -0,0 +1,166 @@
+// Normals
+
+
+bool IsInMirror()
+{
+ return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f;
+}
+
+// Camera
+float3 getCameraPosition()
+{
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+}
+
+float3 getCameraForward()
+{
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1));
+ #endif
+ return normalize(p2 - p1);
+}
+
+float3 grayscale_vector_node()
+{
+ return float3(0, 0.3823529, 0.01845836);
+}
+
+float3 grayscale_for_light()
+{
+ return float3(0.298912, 0.586611, 0.114478);
+}
+
+//Math Operators
+
+float remap(float x, float minOld, float maxOld, float minNew, float maxNew)
+{
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+}
+
+float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew)
+{
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+}
+
+float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew)
+{
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+}
+
+float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew)
+{
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+}
+
+float remapClamped(float x, float minOld, float maxOld, float minNew, float maxNew)
+{
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+}
+
+float2 remapClamped(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew)
+{
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+}
+
+float3 remapClamped(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew)
+{
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+}
+
+float4 remapClamped(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew)
+{
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+}
+
+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);
+}
+
+float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+{
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+{
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiHelpers.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiHelpers.cginc.meta
new file mode 100644
index 00000000..34241ad0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiHelpers.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 6bc22a9fb90a4c84f80445e301fff215
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiLighting.cginc
new file mode 100644
index 00000000..d9a7f785
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiLighting.cginc
@@ -0,0 +1,130 @@
+
+#ifndef POI_LIGHTING
+ #define POI_LIGHTING
+
+ int _LightingType;
+ sampler2D _ToonRamp;
+ float _AdditiveSoftness;
+ float _AdditiveOffset;
+ float _ForceLightDirection;
+ float _ShadowStrength;
+ float _OutlineShadowStrength;
+ float _ShadowOffset;
+ float3 _LightDirection;
+ float _ForceShadowStrength;
+ float _CastedShadowSmoothing;
+ float _IndirectContribution;
+ float _AttenuationMultiplier;
+ float _EnableLighting;
+ float _LightingControlledUseLightColor;
+ uint _LightingAOUV;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_AOMap); float4 _AOMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_LightingShadowMask); float4 _LightingShadowMask_ST;
+ float _AOStrength;
+
+ half PoiDiffuse(half NdotV, half NdotL, half LdotH)
+ {
+ half fd90 = 0.5 + 2 * LdotH * LdotH * SmoothnessToPerceptualRoughness(.5);
+ // Two schlick fresnel term
+ half lightScatter = (1 + (fd90 - 1) * Pow5(1 - NdotL));
+ half viewScatter = (1 + (fd90 - 1) * Pow5(1 - NdotV));
+
+ return lightScatter * viewScatter;
+ }
+
+ float3 ShadeSH9Indirect()
+ {
+ return ShadeSH9(half4(0.0, -1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Direct()
+ {
+ return ShadeSH9(half4(0.0, 1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Normal(float3 normalDirection)
+ {
+ return ShadeSH9(half4(normalDirection, 1.0));
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ x1.b = length(unity_SHBb);
+ return x + x1;
+ }
+
+ float calculateAOMap(float AOMap, float AOStrength)
+ {
+ return lerp(1, AOMap, AOStrength);
+ }
+
+ void calculateBasePassLighting()
+ {
+ float AOMap = 1;
+ #ifndef OUTLINE
+ AOMap = UNITY_SAMPLE_TEX2D_SAMPLER(_AOMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[_LightingAOUV], _AOMap));
+ AOMap = calculateAOMap(AOMap, _AOStrength);
+ #endif
+
+ float3 grayscale_vector = float3(.33333, .33333, .33333);
+ float3 ShadeSH9Plus = GetSHLength();
+ float3 ShadeSH9Minus = ShadeSH9(float4(0, 0, 0, 1));
+
+ #ifndef OUTLINE
+ float ShadowStrengthMap = UNITY_SAMPLE_TEX2D_SAMPLER(_LightingShadowMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _LightingShadowMask)).r;
+ _ShadowStrength *= ShadowStrengthMap;
+ #endif
+
+ float bw_lightColor = dot(poiLight.color, grayscale_vector);
+ float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, _AttenuationMultiplier)) + dot(ShadeSH9Normal(poiMesh.fragmentNormal), grayscale_vector));
+ float bw_bottomIndirectLighting = dot(ShadeSH9Minus, grayscale_vector);
+ float bw_topIndirectLighting = dot(ShadeSH9Plus, grayscale_vector);
+ float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting);
+ poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting);
+
+ poiLight.directLighting = saturate(lerp(ShadeSH9Plus, poiLight.color, .75));
+ poiLight.indirectLighting = saturate(ShadeSH9Minus);
+
+ poiLight.rampedLightMap = tex2D(_ToonRamp, poiLight.lightMap * AOMap + _ShadowOffset);
+
+ if (_LightingType == 0)
+ {
+ poiLight.finalLighting = lerp((poiLight.indirectLighting), lerp(poiLight.directLighting, poiLight.indirectLighting, _IndirectContribution), lerp(1, poiLight.rampedLightMap, _ShadowStrength)) ;
+ }
+ else if(_LightingType == 1)
+ {
+ float3 ramp0 = tex2D(_ToonRamp, float2(1, 1));
+ poiLight.finalLighting = lerp(ramp0, poiLight.rampedLightMap, _ShadowStrength) * poiLight.directLighting;
+ }
+ else if(_LightingType == 2)
+ {
+ float3 real = ShadeSH9(float4(poiMesh.fragmentNormal, 1));
+ poiLight.finalLighting = saturate(_LightColor0.rgb * AOMap * lerp(1, poiLight.attenuation, _AttenuationMultiplier) * (poiLight.nDotL * 0.5 + 0.5) + real);
+ }
+ }
+
+ void calculateLighting()
+ {
+ #ifdef OUTLINE
+ _ShadowStrength = _OutlineShadowStrength;
+ #endif
+ #ifdef FORWARD_BASE_PASS
+ calculateBasePassLighting();
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = poiLight.color * poiLight.attenuation * smoothstep(.5 - _AdditiveSoftness + _AdditiveOffset, .5 + _AdditiveSoftness + _AdditiveOffset, .5 * poiLight.nDotL + .5);
+ #endif
+ #endif
+ }
+ void applyLighting(inout float4 finalColor)
+ {
+ finalColor.rgb *= poiLight.finalLighting;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiLighting.cginc.meta
new file mode 100644
index 00000000..3d397bdc
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiLighting.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1d15d9f6ca638f84f827dafa0d89ebdb
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMainTex.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMainTex.cginc
new file mode 100644
index 00000000..e9a68293
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMainTex.cginc
@@ -0,0 +1,111 @@
+#ifndef POI_MAINTEXTURE
+ #define POI_MAINTEXTURE
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_BumpMap); float4 _BumpMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DetailNormalMap); float4 _DetailNormalMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DetailMask); float4 _DetailMask_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_AlphaMask); float4 _AlphaMask_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_MainFadeTexture); float4 _MainFadeTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DetailTex); float4 _DetailTex_ST;
+ float4 _Color;
+ float _Saturation;
+ float _BumpScale;
+ float _DetailNormalMapScale;
+ float2 _MainNormalPan;
+ float2 _MainDetailNormalPan;
+ float2 _MainDistanceFade;
+ half _MainMinAlpha;
+ half _DetailTexIntensity;
+ half3 _DetailTint;
+ uint _DetailTexUV;
+ uint _DetailNormalUV;
+ float _DetailBrightness;
+ float2 _DetailTexturePan;
+ //globals
+ float alphaMask;
+ half3 diffColor;
+
+ inline FragmentCommonData SpecularSetup(float4 i_tex)
+ {
+ half4 specGloss = 0;
+ half3 specColor = specGloss.rgb;
+ half smoothness = specGloss.a;
+
+ half oneMinusReflectivity;
+ diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specColor, /*out*/ oneMinusReflectivity);
+
+ FragmentCommonData o = (FragmentCommonData)0;
+ o.diffColor = diffColor;
+ o.specColor = specColor;
+ o.oneMinusReflectivity = oneMinusReflectivity;
+ o.smoothness = smoothness;
+ return o;
+ }
+
+ inline FragmentCommonData FragmentSetup(float4 i_tex, half3 i_viewDirForParallax, float3 i_posWorld)
+ {
+ i_tex = i_tex;
+
+ FragmentCommonData o = SpecularSetup(i_tex);
+ o.normalWorld = float4(0, 0, 0, 1);
+ o.eyeVec = poiCam.viewDir;
+ o.posWorld = i_posWorld;
+
+ // NOTE: shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha)
+ o.diffColor = PreMultiplyAlpha(o.diffColor, 1, o.oneMinusReflectivity, /*out*/ o.alpha);
+ return o;
+ }
+
+ void initTextureData()
+ {
+ mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[0], _MainTex));
+
+ #ifdef POI_MIRROR
+ applyMirrorTexture();
+ #endif
+
+ #ifdef _ALPHABLEND_ON
+ calculateDissolve();
+ #endif
+
+ #ifndef POISHADOW
+ alphaMask = UNITY_SAMPLE_TEX2D_SAMPLER(_AlphaMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _AlphaMask));
+ albedo = float4(lerp(mainTexture.rgb, dot(mainTexture.rgb, float3(0.3, 0.59, 0.11)), -_Saturation) * _Color.rgb, mainTexture.a * _Color.a * alphaMask);
+
+ float3 mainNormal = UnpackScaleNormal(UNITY_SAMPLE_TEX2D_SAMPLER(_BumpMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _BumpMap) + _Time.x * _MainNormalPan), _BumpScale);
+ float3 detailMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DetailMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DetailMask));
+ float3 detailNormal = UnpackScaleNormal(UNITY_SAMPLE_TEX2D_SAMPLER(_DetailNormalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[_DetailNormalUV], _DetailNormalMap) + _Time.x * _MainDetailNormalPan), _DetailNormalMapScale * detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(mainNormal, detailNormal);
+
+ albedo.rgb *= lerp(1, UNITY_SAMPLE_TEX2D_SAMPLER(_DetailTex, _MainTex, TRANSFORM_TEX(poiMesh.uv[_DetailTexUV], _DetailTex) + _Time.x * _DetailTexturePan).rgb * _DetailBrightness * _DetailTint * unity_ColorSpaceDouble, detailMask.r * _DetailTexIntensity);
+ albedo.rgb = saturate(albedo.rgb);
+ poiMesh.fragmentNormal = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent +
+ poiMesh.tangentSpaceNormal.y * poiMesh.bitangent +
+ poiMesh.tangentSpaceNormal.z * poiMesh.vertexNormal
+ );
+
+ poiLight.nDotV = dot(poiMesh.fragmentNormal, poiCam.viewDir);
+ poiLight.vNDotV = dot(poiMesh.vertexNormal, poiCam.viewDir);
+ poiLight.nDotL = dot(poiMesh.fragmentNormal, poiLight.direction);
+ poiLight.nDotH = dot(poiMesh.fragmentNormal, poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+
+ poiCam.viewDotNormal = abs(dot(poiCam.viewDir, poiMesh.fragmentNormal));
+
+
+ s = FragmentSetup(float4(poiMesh.uv[0], 1, 1), poiCam.viewDir, poiMesh.worldPos);
+ #endif
+ }
+
+ void distanceFade()
+ {
+ half fadeMap = UNITY_SAMPLE_TEX2D_SAMPLER(_MainFadeTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _MainFadeTexture));
+ if(fadeMap)
+ {
+ half fadeValue = max(smoothstep(_MainDistanceFade.x, _MainDistanceFade.y, poiCam.distanceToVert), _MainMinAlpha);
+ albedo.a *= fadeValue;
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMainTex.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMainTex.cginc.meta
new file mode 100644
index 00000000..ec48a374
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMainTex.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c3b00376224897b47b655455939a4ea3
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMatcap.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMatcap.cginc
new file mode 100644
index 00000000..1a07fa7e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMatcap.cginc
@@ -0,0 +1,82 @@
+#ifndef MATCAP
+ #define MATCAP
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap);
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_MatcapMask); float4 _MatcapMask_ST;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap2);
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap2Mask); float4 _Matcap2Mask_ST;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+
+ float3 matcap;
+ float matcapMask;
+ float3 matcap2;
+ float matcap2Mask;
+
+
+
+ void calculateMatcap()
+ {
+ // Both matcaps use the same coordinates
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+
+ // Matcap 1
+ half2 matcapUV = half2(dot(worldViewRight, poiMesh.fragmentNormal), dot(worldViewUp, poiMesh.fragmentNormal)) * _MatcapBorder + 0.5;
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, matcapUV) * _MatcapColor;
+ matcap.rgb *= _MatcapIntensity;
+ matcapMask = UNITY_SAMPLE_TEX2D_SAMPLER(_MatcapMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _MatcapMask));
+ #ifdef POI_LIGHTING
+ if (_MatcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, _MatcapLightMask);
+ }
+ #endif
+
+ // Matcap 2
+ UNITY_BRANCH
+ if (_Matcap2Enable)
+ {
+ half2 matcapUV2 = half2(dot(worldViewRight, poiMesh.fragmentNormal), dot(worldViewUp, poiMesh.fragmentNormal)) * _Matcap2Border + 0.5;
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, matcapUV2) * _Matcap2Color;
+ matcap2 *= _Matcap2Intensity;
+ matcap2Mask = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2Mask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _Matcap2Mask));
+ #ifdef POI_LIGHTING
+ if(_Matcap2LightMask)
+ {
+ matcap2Mask *= lerp(1, poiLight.rampedLightMap, _Matcap2LightMask);
+ }
+ #endif
+ }
+ }
+
+ void applyMatcap(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor, matcap, _MatcapReplace * matcapMask);
+ finalColor.rgb *= lerp(1, matcap, _MatcapMultiply * matcapMask);
+ finalColor.rgb += matcap * _MatcapAdd * matcapMask;
+
+ UNITY_BRANCH
+ if(_Matcap2Enable)
+ {
+ finalColor.rgb = lerp(finalColor, matcap2, _Matcap2Replace * matcap2Mask);
+ finalColor.rgb *= lerp(1, matcap2, _Matcap2Multiply * matcap2Mask);
+ finalColor.rgb += matcap2 * _Matcap2Add * matcap2Mask;
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMatcap.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMatcap.cginc.meta
new file mode 100644
index 00000000..9dbae768
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMatcap.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8474ec9ebe6a13f4194926910b94c501
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMetal.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMetal.cginc
new file mode 100644
index 00000000..186211a7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMetal.cginc
@@ -0,0 +1,82 @@
+#ifndef POI_METAL
+ #define POI_METAL
+
+ samplerCUBE _CubeMap;
+ float _SampleWorld;
+ sampler2D _MetallicMask; float4 _MetallicMask_ST;
+ float _Metallic;
+ sampler2D _SmoothnessMask; float4 _SmoothnessMask_ST;
+ float _InvertSmoothness;
+ float _Smoothness;
+ float _EnableMetallic;
+ float3 _MetalReflectionTint;
+
+ float3 finalreflections;
+ float metalicMap;
+ float3 reflection;
+ float roughness;
+ float lighty_boy_uwu_var;
+
+ void calculateReflections()
+ {
+ metalicMap = tex2D(_MetallicMask, TRANSFORM_TEX(poiMesh.uv[0], _MetallicMask)) * _Metallic;
+ float _Smoothness_map_var = (tex2D(_SmoothnessMask, TRANSFORM_TEX(poiMesh.uv[0], _SmoothnessMask)));
+ if (_InvertSmoothness == 1)
+ {
+ _Smoothness_map_var = 1 - _Smoothness_map_var;
+ }
+ _Smoothness_map_var *= _Smoothness;
+ roughness = 1 - _Smoothness_map_var;
+ roughness *= 1.7 - 0.7 * roughness;
+ float3 reflectedDir = poiCam.reflectionDir;
+
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ //Probe 1
+ float4 reflectionData0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 reflectionColor0 = DecodeHDR(reflectionData0, unity_SpecCube0_HDR);
+
+ //Probe 2
+ float4 reflectionData1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 reflectionColor1 = DecodeHDR(reflectionData1, unity_SpecCube1_HDR);
+
+ reflection = lerp(reflectionColor1, reflectionColor0, interpolator);
+ }
+ else
+ {
+ float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ reflection = DecodeHDR(reflectionData, unity_SpecCube0_HDR);
+ }
+
+ bool no_probe = unity_SpecCube0_HDR.a == 0 && envSample.a == 0;
+ lighty_boy_uwu_var = 0;
+ if (no_probe || _SampleWorld)
+ {
+ lighty_boy_uwu_var = 1;
+ reflection = texCUBElod(_CubeMap, float4(reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ }
+ }
+
+ void applyReflections(inout float4 finalColor, float4 finalColorBeforeLighting)
+ {
+ #ifdef FORWARD_BASE_PASS
+ finalreflections = reflection.rgb * finalColorBeforeLighting.rgb * _MetalReflectionTint;
+ finalColor.rgb = finalColor.rgb * (1 - metalicMap);
+ #ifdef POI_LIGHTING
+ finalColor.rgb += (finalreflections * ((1 - roughness + metalicMap) / 2)) * lerp(1, poiLight.finalLighting, lighty_boy_uwu_var);
+ #else
+ finalColor.rgb += (finalreflections * ((1 - roughness + metalicMap) / 2));
+ #endif
+
+ #endif
+ }
+
+ void applyAdditiveReflectiveLighting(inout float4 finalColor)
+ {
+ finalColor *= (1 - metalicMap);
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMetal.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMetal.cginc.meta
new file mode 100644
index 00000000..d294cebe
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMetal.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8846817db36f515459b5bbb6a83b8fea
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMirror.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMirror.cginc
new file mode 100644
index 00000000..40c86086
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMirror.cginc
@@ -0,0 +1,77 @@
+#ifndef POI_MIRROR
+ #define POI_MIRROR
+
+ int _Mirror;
+ float _EnableMirrorTexture;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_MirrorTexture); float4 _MirrorTexture_ST;
+
+
+ void applyMirrorRenderVert(inout float4 vertex)
+ {
+ UNITY_BRANCH
+ if (_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ void applyMirrorRenderFrag()
+ {
+ UNITY_BRANCH
+ if(_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ void applyMirrorTexture()
+ {
+ UNITY_BRANCH
+ if(_EnableMirrorTexture)
+ {
+ if(IsInMirror())
+ {
+ mainTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_MirrorTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _MirrorTexture));
+ }
+ }
+ }
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMirror.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMirror.cginc.meta
new file mode 100644
index 00000000..4db0bbc8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiMirror.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 396d9bd19d1b5e04faf3ed13c4cb261e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineFrag.cginc
new file mode 100644
index 00000000..48089cac
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineFrag.cginc
@@ -0,0 +1,55 @@
+float _OutlineRimLightBlend;
+float _Clip;
+float4 frag(v2f i): COLOR
+{
+
+ #ifdef POI_DATA
+ InitData(i);
+ #endif
+
+ #ifdef POI_MAINTEXTURE
+ initTextureData();
+ #endif
+
+ fixed4 col = mainTexture;
+ float alphaMultiplier = smoothstep(_OutlineFadeDistance.x, _OutlineFadeDistance.y, distance(getCameraPosition(), i.worldPos));
+ clip(_LineWidth - 0.001);
+ float _alphaMask_tex_var = UNITY_SAMPLE_TEX2D_SAMPLER(_AlphaMask, _MainTex, TRANSFORM_TEX(i.uv0, _AlphaMask));
+ col = col * 0.00000000001 + tex2D(_OutlineTexture, TRANSFORM_TEX((i.uv0 + (_OutlineTexturePan.xy * _Time.g)), _OutlineTexture));
+ col.a *= albedo.a;
+ col.a *= alphaMultiplier;
+
+ #ifdef POI_RANDOM
+ col.a *= i.angleAlpha;
+ #endif
+
+ clip(col.a * _alphaMask_tex_var - _Clip);
+
+ UNITY_BRANCH
+ if (_OutlineMode == 1)
+ {
+ #ifdef POI_MIRROR
+ applyMirrorTexture();
+ #endif
+ col.rgb = mainTexture.rgb;
+ }
+ else if(_OutlineMode == 2)
+ {
+ col.rgb = lerp(col.rgb, poiLight.color, _OutlineRimLightBlend);
+ }
+ col *= _LineColor;
+
+
+ #ifdef POI_LIGHTING
+ calculateLighting();
+ #endif
+
+ float4 finalColor = col;
+
+ #ifdef POI_LIGHTING
+ applyLighting(finalColor);
+ #endif
+
+ finalColor.rgb += (col.rgb * _OutlineEmission);
+ return finalColor;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineFrag.cginc.meta
new file mode 100644
index 00000000..72e1c8f7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineFrag.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 72b7fa42c9f90df4f83dc6c3706edf33
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineVert.cginc
new file mode 100644
index 00000000..ba64f417
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineVert.cginc
@@ -0,0 +1,72 @@
+#ifndef OutlineVert
+ #define OutlineVert
+
+ uint _OutlineMode;
+ float4 _OutlinePersonaDirection;
+ float4 _OutlineDropShadowOffset;
+ float _OutlineUseVertexColors;
+
+ sampler2D _OutlineMask; float4 _OutlineMask_ST;
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ UNITY_INITIALIZE_OUTPUT(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderVert(v.vertex);
+ #endif
+
+ o.uv0 = v.uv0 + _OutlineGlobalPan.xy * _Time.y;
+ float outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(TRANSFORM_TEX(o.uv0, _OutlineMask) + _Time.x * _OutlineTexturePan.zw, 0, 0)).rgb);
+
+ UNITY_BRANCH
+ if (_OutlineUseVertexColors == 0)
+ {
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ }
+ else
+ {
+ o.normal = UnityObjectToWorldNormal(v.color);
+ }
+
+
+ float3 offset = o.normal * (_LineWidth / 100) * outlineMask;
+
+ half offsetMultiplier = 1;
+ UNITY_BRANCH
+ if(_OutlineMode == 2)
+ {
+ float3 lightDirection = poiLight.direction = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, o.normal));
+ offset *= offsetMultiplier;
+ }
+ else if(_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, o.normal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ }
+ else if(_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ }
+
+ o.worldPos = mul(unity_ObjectToWorld, v.vertex) + float4(offset, 0);
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ o.pos = UnityWorldToClipPos(o.worldPos);
+
+ o.angleAlpha = 1;
+ #ifdef POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos);
+ #endif
+
+ UNITY_TRANSFER_SHADOW(o, o.uv0);
+ UNITY_TRANSFER_FOG(o, o.pos);
+ return o;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineVert.cginc.meta
new file mode 100644
index 00000000..85fbee5f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiOutlineVert.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bd3b68bfdcc9cb24aa10b4cc6b447572
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPanosphere.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPanosphere.cginc
new file mode 100644
index 00000000..80156c6f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPanosphere.cginc
@@ -0,0 +1,55 @@
+#ifndef PANOSPHERE
+ #define PANOSPHERE
+
+ sampler2D _PanosphereTexture; float4 _PanosphereTexture_ST;
+ sampler2D _PanoMapTexture; float4 _PanoMapTexture_ST;
+ float _PanoEmission;
+ float _PanoBlend;
+ float4 _PanosphereColor;
+ float3 _PanospherePan;
+ float _PanoToggle;
+ float _PanoCubeMapToggle;
+ samplerCUBE _PanoCubeMap; half4 _PanoCubeMap_HDR;
+
+ float3 panoColor;
+ float panoMask;
+
+ float2 projectIt(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude + _Time.y * _PanospherePan.x, latitude + _Time.y * _PanospherePan.y) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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;
+ }
+
+ void calculatePanosphere()
+ {
+ panoMask = tex2D(_PanoMapTexture, TRANSFORM_TEX(poiMesh.uv[0], _PanoMapTexture));
+
+ UNITY_BRANCH
+ if (_PanoCubeMapToggle)
+ {
+ float3 cubeUV = mul(poiRotationMatrixFromAngles(_PanospherePan.xyz * _Time.y) ,float4(-poiCam.viewDir,1));
+ half4 cubemap = texCUBE (_PanoCubeMap, cubeUV);
+ panoColor = DecodeHDR (cubemap, _PanoCubeMap_HDR);
+ }
+ else
+ {
+ float2 _StereoEnabled_var = projectIt(normalize(poiCam.worldPos.xyz - poiMesh.worldPos.xyz) * - 1);
+ panoColor = tex2D(_PanosphereTexture, TRANSFORM_TEX(_StereoEnabled_var, _PanosphereTexture)) * _PanosphereColor.rgb;
+ }
+ }
+
+ void applyPanosphereColor(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor.rgb, panoColor, _PanoBlend * panoMask);
+ }
+
+ void applyPanosphereEmission(inout float4 finalColor)
+ {
+ finalColor.rgb += panoColor * _PanoBlend * panoMask * _PanoEmission;
+ }
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPanosphere.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPanosphere.cginc.meta
new file mode 100644
index 00000000..17b64500
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPanosphere.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b4539cf5f665abd48abf34625dc7e7f2
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParallax.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParallax.cginc
new file mode 100644
index 00000000..ccad8d30
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParallax.cginc
@@ -0,0 +1,121 @@
+#ifndef POI_PARALLAX
+ #define POI_PARALLAX
+
+ sampler2D _ParallaxHeightMap; float4 _ParallaxHeightMap_ST;
+ float _ParallaxHeightIterations;
+ float _ParallaxStrength;
+ float _ParallaxBias;
+ float _ParallaxHeightMapEnabled;
+
+ //Internal
+ float _ParallaxInternalMapEnabled;
+ sampler2D _ParallaxInternalMap; float4 _ParallaxInternalMap_ST;
+ float _ParallaxInternalIterations;
+ float _ParallaxInternalMinDepth;
+ float _ParallaxInternalMaxDepth;
+ float _ParallaxInternalMinFade;
+ float _ParallaxInternalMaxFade;
+ float4 _ParallaxInternalMinColor;
+ float4 _ParallaxInternalMaxColor;
+ float4 _ParallaxInternalPanSpeed;
+ float4 _ParallaxInternalPanDepthSpeed;
+ float _ParallaxInternalHeightmapMode;
+ float _ParallaxInternalHeightFromAlpha;
+
+ float GetParallaxHeight(float2 uv)
+ {
+ return clamp(tex2D(_ParallaxHeightMap, TRANSFORM_TEX(uv, _ParallaxHeightMap)).g, 0, .99999);
+ }
+ /*
+ float2 ParallaxOffset(float2 viewDir)
+ {
+ float height = GetParallaxHeight();
+ height -= 0.5;
+ height *= _ParallaxStrength;
+ return viewDir * height;
+ }
+ */
+ float2 ParallaxRaymarching(float2 viewDir)
+ {
+ float2 uvOffset = 0;
+ float stepSize = 0.1;
+ float2 uvDelta = viewDir * (stepSize * _ParallaxStrength);
+
+ float stepHeight = 1;
+ float surfaceHeight = GetParallaxHeight(poiMesh.uv[0]);
+
+ float2 prevUVOffset = uvOffset;
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ for (int i = 1; i < _ParallaxHeightIterations && stepHeight > surfaceHeight; i ++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ surfaceHeight = GetParallaxHeight(poiMesh.uv[0] + uvOffset);
+ }
+
+ float prevDifference = prevStepHeight - prevSurfaceHeight;
+ float difference = surfaceHeight - stepHeight;
+ float t = prevDifference / (prevDifference + difference);
+ uvOffset = prevUVOffset -uvDelta * t;
+
+ return uvOffset;
+ }
+
+ void calculateandApplyParallax(v2f i)
+ {
+ UNITY_BRANCH
+ if (_ParallaxHeightMapEnabled)
+ {
+ i.tangentViewDir = normalize(i.tangentViewDir);
+ i.tangentViewDir.xy /= (i.tangentViewDir.z + _ParallaxBias);
+ poiMesh.uv[0] += ParallaxRaymarching(i.tangentViewDir.xy);
+ }
+ }
+
+ void calculateAndApplyInternalParallax()
+ {
+ #if defined(_PARALLAXMAP)
+ UNITY_BRANCH
+ if(_ParallaxInternalMapEnabled)
+ {
+ float3 parallax = 0;
+ for (int j = _ParallaxInternalIterations; j > 0; j --)
+ {
+ float ratio = (float)j / _ParallaxInternalIterations;
+ float2 parallaxOffset = _Time.y * (_ParallaxInternalPanSpeed + (1 - ratio) * _ParallaxInternalPanDepthSpeed);
+ float fade = lerp(_ParallaxInternalMinFade, _ParallaxInternalMaxFade, ratio);
+ float4 parallaxColor = tex2D(_ParallaxInternalMap, TRANSFORM_TEX(poiMesh.uv[0], _ParallaxInternalMap) + lerp(_ParallaxInternalMinDepth, _ParallaxInternalMaxDepth, ratio) * - poiCam.tangentViewDir.xy + parallaxOffset);
+ float3 parallaxTint = lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, ratio);
+ float parallaxHeight;
+ if(_ParallaxInternalHeightFromAlpha)
+ {
+ parallaxTint *= parallaxColor.rgb;
+ parallaxHeight = parallaxColor.a;
+ }
+ else
+ {
+ parallaxHeight = parallaxColor.r;
+ }
+ //float parallaxColor *= lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, 1 - ratio);
+ UNITY_BRANCH
+ if (_ParallaxInternalHeightmapMode == 1)
+ {
+ parallax = lerp(parallax, parallaxTint * fade, parallaxHeight >= 1 - ratio);
+ }
+ else
+ {
+ parallax += parallaxTint * parallaxHeight * fade;
+ }
+ }
+ //parallax /= _ParallaxInternalIterations;
+ finalColor.rgb += parallax;
+ }
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParallax.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParallax.cginc.meta
new file mode 100644
index 00000000..8d77bb2e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParallax.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 32a3c22a538f985479cb843e28d1f2a5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParticlePass.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParticlePass.cginc
new file mode 100644
index 00000000..5e85e1cf
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParticlePass.cginc
@@ -0,0 +1,343 @@
+#pragma vertex vert
+#pragma fragment frag
+#pragma multi_compile_instancing
+#include "UnityCG.cginc"
+#include "Lighting.cginc"
+
+struct appdata
+{
+ float4 vertex: POSITION;
+ float4 color: COLOR;
+ float2 texcoord: TEXCOORD0;
+ uint id: SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+};
+
+struct v2g
+{
+ float4 pos: SV_POSITION;
+ float2 uv: TEXCOORD0;
+ float4 worldPos: TEXCOORD1;
+ uint vid: TEXCOORD2;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+};
+
+struct g2f
+{
+ float4 pos: SV_POSITION;
+ float2 uv: TEXCOORD0;
+ uint TimeOffset: TEXCOORD2;
+ float4 DebugData: TEXCOORD3;
+ float Alpha: TEXCOORD4;
+ float4 screenUV: TEXCOORD5;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+};
+
+float random(float2 vids)
+{
+ return frac(sin(dot(vids, float2(12.9898, 78.2383))) * 43758.5453123);
+}
+
+sampler2D _CameraDepthTexture;
+sampler2D _ParticleMask;
+float4 _ParticleColor;
+uint _ParticleMovementMode;
+float _ParticleScaleMin, _ParticleScaleMax;
+float _ParticleSphericalMinSpeed, _ParticleSphericalMaxSpeed;
+float _ParticleSphericalMinRadius, _ParticleSphericalMaxRadius;
+float _ParticleRandomTimeOffset;
+float _ParticlePerCMSquared;
+float _ParticleMinRenderDistance;
+float _ParticleRandomRotation;
+float _ParticleRotation;
+// Linear Movement
+float3 _ParticleLinearEndOffsetMin;
+float3 _ParticleLinearEndOffsetMax;
+float _ParticleLinearSpeedMin;
+float _ParticleLinearSpeedMax;
+float _ParticleLinearStartAlpha ;
+float _ParticleLinearEndAlpha;
+float _ParticleLinearStartSizeMin;
+float _ParticleLinearStartSizeMax;
+float _ParticleLinearEndSizeMin;
+float _ParticleLinearEndsizeMax;
+float _ParticleLinearNormalRange;
+float _ParticleFlipParticlesGoingInward;
+v2g particleVert(appdata v)
+{
+ v2g o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ o.pos = UnityObjectToClipPos(v.vertex);
+ o.worldPos = mul(unity_ObjectToWorld, v.vertex);
+ o.uv = v.texcoord.xy;
+ o.vid = v.id;
+ return o;
+}
+
+void calculateParticleData(float4 startPos, float3 vid, float randomA, float randomB, float randomC, float randomD,
+inout float4 offset, inout float scale, inout float opacity, inout float randomRotation, inout float loopAlpha)
+{
+ UNITY_BRANCH
+ if (_ParticleMovementMode == 0) //spherical
+ {
+ float3 vroom = float3(lerp(_ParticleSphericalMinSpeed, _ParticleSphericalMaxSpeed, randomA), lerp(_ParticleSphericalMinSpeed, _ParticleSphericalMaxSpeed, randomB), lerp(_ParticleSphericalMinSpeed, _ParticleSphericalMaxSpeed, randomC));
+ scale = lerp(_ParticleScaleMin, _ParticleScaleMax, randomC);
+ offset.x = sin(_Time.x * vroom.x) * lerp(_ParticleSphericalMinRadius, _ParticleSphericalMaxRadius, randomA);
+ offset.y = sin(_Time.x * vroom.y) * lerp(_ParticleSphericalMinRadius, _ParticleSphericalMaxRadius, randomB);
+ offset.z = sin(_Time.x * vroom.z) * lerp(_ParticleSphericalMinRadius, _ParticleSphericalMaxRadius, randomC);
+ offset.w = 0;
+ }
+ else
+ {
+ float speed = lerp(_ParticleLinearSpeedMin, _ParticleLinearSpeedMax, randomD);
+ float alpha = (_Time.x + randomD) * speed;
+ float randomPerLoop = random(float2(ceil(alpha), ceil(alpha)));
+ randomRotation = (randomPerLoop) * 6.28318530718;
+ alpha = frac(alpha);
+ loopAlpha = alpha;
+ offset = float4(lerp(0, float3(
+ lerp(_ParticleLinearEndOffsetMin.x, _ParticleLinearEndOffsetMax.x, randomA),
+ lerp(_ParticleLinearEndOffsetMin.y, _ParticleLinearEndOffsetMax.y, randomB),
+ lerp(_ParticleLinearEndOffsetMin.z, _ParticleLinearEndOffsetMax.z, randomC)
+ ), alpha), 0);
+ float scaleStart = lerp(_ParticleLinearStartSizeMin, _ParticleLinearStartSizeMax, randomC);
+ float scaleEnd = lerp(_ParticleLinearEndSizeMin, _ParticleLinearEndsizeMax, randomD);
+ scale = lerp(scaleStart, scaleEnd, alpha);
+ opacity = saturate(lerp(_ParticleLinearStartAlpha, _ParticleLinearEndAlpha, alpha));
+ }
+}
+
+float ComputePolygonArea(float3 p1, float3 p2, float3 p3)
+{
+ return length(cross(p2 - p1, p3 - p1)) / 2;
+}
+
+bool IsInMirror()
+{
+ return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f;
+}
+
+float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+{
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+[maxvertexcount(60)]
+void particleGeom(triangle v2g IN[3], inout TriangleStream < g2f > tristream)
+{
+ float3 polySideA = IN[1].worldPos.xyz - IN[0].worldPos.xyz;
+ float3 polySideB = IN[2].worldPos.xyz - IN[0].worldPos.xyz;
+ float3 c = cross(polySideA, polySideB);
+ float3 outDir = normalize(c);
+ float4 center = (IN[0].worldPos + IN[1].worldPos + IN[2].worldPos) / 3;
+
+ if (_ParticleMovementMode == 1)
+ {
+ float3 direction = normalize((center.xyz + lerp(_ParticleLinearEndOffsetMin, _ParticleLinearEndOffsetMax, .5).rgb) - center.xyz);
+ if(dot(outDir, direction) <= _ParticleLinearNormalRange)
+ {
+ return;
+ }
+ }
+
+ g2f milk[4];
+
+ if(IsInMirror())
+ {
+ milk[0].uv = float2(0, 1);
+ milk[1].uv = float2(0, 0);
+ milk[2].uv = float2(1, 0);
+ milk[3].uv = float2(1, 1);
+ }
+ else
+ {
+ milk[0].uv = float2(0, 0);
+ milk[1].uv = float2(0, 1);
+ milk[2].uv = float2(1, 1);
+ milk[3].uv = float2(1, 0);
+ }
+
+ float areaOfPolygonCM = ComputePolygonArea(IN[0].worldPos, IN[1].worldPos, IN[2].worldPos) * 10000; // 100000 square cm in 1 square m
+ float randomlySpawnedParticle = 0;
+ if (areaOfPolygonCM < 1 / _ParticlePerCMSquared)
+ {
+ randomlySpawnedParticle = random(float2(IN[0].vid, IN[1].vid)) < areaOfPolygonCM / (1 / _ParticlePerCMSquared);
+ }
+
+ float numberOfParticles = clamp(floor(areaOfPolygonCM * _ParticlePerCMSquared + .05) + randomlySpawnedParticle, 0, 10);
+
+ numberOfParticles *= tex2Dlod(_ParticleMask, float4((IN[0].uv + IN[1].uv + IN[2].uv) / 3, 0, 0)).r;
+
+ for (int index = 0; index < 4; index ++)
+ {
+ milk[index].DebugData = 0;
+ milk[index].DebugData.x = randomlySpawnedParticle;
+ milk[index].DebugData.y = randomlySpawnedParticle;
+ milk[index].DebugData.z = random(float2(IN[0].vid, IN[1].vid));
+ milk[index].DebugData.w = randomlySpawnedParticle;
+
+ milk[index].Alpha = 1;
+ }
+
+
+ for (int index = 0; index < numberOfParticles; index ++)
+ {
+ float randomValueA = random(float2(IN[0].vid + index * IN[2].vid, IN[2].vid + index * IN[0].vid));
+ float randomValueB = random(float2(IN[1].vid + index * IN[2].vid, IN[1].vid + index * IN[0].vid));
+ float randomValueC = random(float2(IN[2].vid + index * IN[2].vid, IN[0].vid + index * IN[0].vid));
+ float randomValueD = random(float2(IN[1].vid + index * IN[2].vid, IN[0].vid + index * (IN[1].vid + IN[2].vid)));
+ float randomRotation = randomValueD * 6.28318530718;
+ float scale = 1;
+ float4 offset = 0;
+ float opacity = 1;
+ float loopAlpha = 0;
+
+ calculateParticleData(center, float3(IN[0].vid, IN[1].vid, IN[2].vid),
+ randomValueA, randomValueB, randomValueC, randomValueD, offset, scale, opacity, randomRotation, loopAlpha);
+
+
+ milk[0].DebugData = float4(loopAlpha, randomValueB, randomValueC, randomValueD);
+ milk[1].DebugData = float4(loopAlpha, randomValueB, randomValueC, randomValueD);
+ milk[2].DebugData = float4(loopAlpha, randomValueB, randomValueC, randomValueD);
+ milk[3].DebugData = float4(loopAlpha, randomValueB, randomValueC, randomValueD);
+
+ UNITY_BRANCH
+ if(_ParticleFlipParticlesGoingInward && _ParticleMovementMode == 1)
+ {
+ float3 offsetdirection = (center + offset).xyz - center.xyz;
+ if(dot(offsetdirection, outDir) <= 0)
+ {
+ offset *= -1;
+ }
+ }
+
+ float4 forwardVector = float4(normalize((center + offset) - _WorldSpaceCameraPos), 0);
+ float4 rightVector = float4(-UNITY_MATRIX_V[0].xyz, 0);
+ rightVector.xyz = mul(poiAngleAxisRotationMatrix(_ParticleRandomRotation ? randomRotation: radians(_ParticleRotation), forwardVector), rightVector);
+ float4 upVector = float4(cross(forwardVector, rightVector), 0);
+
+ milk[0].Alpha = opacity;
+ milk[1].Alpha = opacity;
+ milk[2].Alpha = opacity;
+ milk[3].Alpha = opacity;
+
+ float timeOffset = _ParticleRandomTimeOffset ? lerp(0, 1000, randomValueA): 0;
+
+ milk[0].TimeOffset = timeOffset;
+ milk[1].TimeOffset = timeOffset;
+ milk[2].TimeOffset = timeOffset;
+ milk[3].TimeOffset = timeOffset;
+
+ if(randomValueA + randomValueB >= 1)
+ {
+ randomValueA = 1 - randomValueA;
+ randomValueB = 1 - randomValueB;
+ }
+
+ float4 positionInPolygon = float4(IN[0].worldPos.xyz + (polySideA * randomValueA) + (polySideB * randomValueB), 1) + offset;
+
+ milk[0].pos = UnityObjectToClipPos(mul(unity_WorldToObject, positionInPolygon + (rightVector + upVector) * scale));
+ milk[1].pos = UnityObjectToClipPos(mul(unity_WorldToObject, positionInPolygon + (rightVector + - upVector) * scale));
+ milk[2].pos = UnityObjectToClipPos(mul(unity_WorldToObject, positionInPolygon + (-rightVector + - upVector) * scale));
+ milk[3].pos = UnityObjectToClipPos(mul(unity_WorldToObject, positionInPolygon + (-rightVector + upVector) * scale));
+
+ milk[0].screenUV = ComputeScreenPos(milk[0].pos);
+ milk[1].screenUV = ComputeScreenPos(milk[1].pos);
+ milk[2].screenUV = ComputeScreenPos(milk[2].pos);
+ milk[3].screenUV = ComputeScreenPos(milk[3].pos);
+
+ if(distance(positionInPolygon, _WorldSpaceCameraPos) >= _ParticleMinRenderDistance)
+ {
+ tristream.Append(milk[0]);
+ tristream.Append(milk[1]);
+ tristream.Append(milk[2]);
+ tristream.RestartStrip();
+
+ tristream.Append(milk[2]);
+ tristream.Append(milk[3]);
+ tristream.Append(milk[0]);
+ tristream.RestartStrip();
+ }
+ }
+}
+
+sampler2D _ParticleTexture; float4 _ParticleTexture_ST;
+sampler2D _ParticleStartColorGradient; float4 _ParticleStartColorGradient_ST;
+UNITY_DECLARE_TEX2DARRAY(_ParticleFlipbookTexArray); float4 _ParticleFlipbookTexArray_ST;
+float4 _ParticleFlipbookColor;
+float _ParticleFlipbookFPS;
+uint _ParticleFlipbookTotalFrames;
+float _ParticleFlipbookTiled;
+int _ParticleFlipbookCurrentFrame;
+float _ParticleFlipbookEmissionStrength;
+float _ParticleFlipbookRotation;
+float _EnableParticleFlipbook;
+float _ParticleAlphaCutoff;
+float _ParticleIntersectionFadeDistance;
+float _ParticleLit;
+float _ColorOverLifetime;
+float _ColorOverLifeSpeed;
+// anim
+uint _ParticleFlipbookMovementType;
+float4 _ParticleFlipbookStartEndOffset;
+float _ParticleFlipbookMovementSpeed;
+
+void getFlipbookColor(inout float4 finalColor, float2 uv, float timeOffset)
+{
+ UNITY_BRANCH
+ if (_EnableParticleFlipbook)
+ {
+ uint currentFrame = floor(_ParticleFlipbookCurrentFrame) % _ParticleFlipbookTotalFrames;
+ if(_ParticleFlipbookCurrentFrame < 0)
+ {
+ if(_ParticleFlipbookFPS < 1)
+ {
+ currentFrame = timeOffset % _ParticleFlipbookTotalFrames;
+ }
+ else
+ {
+ currentFrame = ((_Time.y + timeOffset) / (1 / max(_ParticleFlipbookFPS, 1))) % _ParticleFlipbookTotalFrames;
+ }
+ }
+ finalColor = UNITY_SAMPLE_TEX2DARRAY(_ParticleFlipbookTexArray, float3(TRANSFORM_TEX(uv, _ParticleFlipbookTexArray), currentFrame));
+ }
+}
+
+fixed4 particleFrag(g2f i): SV_Target
+{
+ UNITY_SETUP_INSTANCE_ID(i);
+ fixed4 finalColor;
+ float2 colorUV = i.DebugData.w;
+
+ if(_ColorOverLifetime && _ParticleMovementMode == 0)
+ {
+ colorUV = frac(i.DebugData.w + _Time.x * _ColorOverLifeSpeed);
+ }
+ else if(_ColorOverLifetime && _ParticleMovementMode == 1)
+ {
+ colorUV = i.DebugData.x;
+ }
+
+ float2 randomStartColor = i.DebugData.w + i.DebugData.x;
+ float3 randomColor = tex2D(_ParticleStartColorGradient, TRANSFORM_TEX(colorUV, _ParticleStartColorGradient));
+ finalColor = tex2D(_ParticleTexture, TRANSFORM_TEX(i.uv, _ParticleTexture));
+ getFlipbookColor(finalColor, i.uv, i.TimeOffset);
+ clip(finalColor.a - _ParticleAlphaCutoff);
+ finalColor.rgb *= _ParticleColor.rgb * randomColor.rgb;
+ finalColor.rgb *= _ParticleLit ? saturate(ShadeSH9(float4(0.0, 0.0, 0.0, 1.0))) + _LightColor0.rgb: 1;
+ finalColor.a *= i.Alpha * _ParticleColor.a;
+ return finalColor;
+}
+
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParticlePass.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParticlePass.cginc.meta
new file mode 100644
index 00000000..25cbf641
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiParticlePass.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7178b86448a50944e97378d3e6f4ade2
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPass.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPass.cginc
new file mode 100644
index 00000000..901f149d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPass.cginc
@@ -0,0 +1,124 @@
+/*
+_SPECGLOSSMAP
+_PARALLAXMAP
+_EMISSION
+_REQUIRE_UV2
+_ALPHABLEND_ON
+_DETAIL_MULX2
+_FADING_ON
+_GLOSSYREFLECTIONS_OFF
+_METALLICGLOSSMAP
+_TERRAIN_NORMAL_MAP
+_COLOROVERLAY_ON
+_COLORADDSUBDIFF_ON
+_NORMALMAP
+_SUNDISK_NONE
+_COLORCOLOR_ON
+
+_ALPHAMODULATE_ON
+_ALPHAPREMULTIPLY_ON
+_ALPHATEST_ON
+_MAPPING_6_FRAMES_LAYOUT
+_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
+_SPECULARHIGHLIGHTS_OFF
+_SUNDISK_HIGH_QUALITY
+_SUNDISK_SIMPLE
+BILLBOARD_FACE_CAMERA_POS
+EFFECT_BUMP
+EFFECT_HUE_VARIATION
+ETC1_EXTERNAL_ALPHA
+GEOM_TYPE_BRANCH
+EFFECT_BUMP
+GEOM_TYPE_FROND
+GEOM_TYPE_LEAF
+GEOM_TYPE_MESH
+LOD_FADE_CROSSFADE
+PIXELSNAP_ON
+SOFTPARTICLES_ON
+STEREO_INSTANCING_ON
+STEREO_MULTIVIEW_ON
+UNITY_HDR_ON
+UNITY_SINGLE_PASS_STEREO
+UNITY_UI_ALPHACLIP
+UNITY_UI_CLIP_RECT
+*/
+
+
+#ifndef POI_PASS
+ #define POI_PASS
+
+ #include "Poicludes.cginc"
+ #include "PoiHelpers.cginc"
+
+ #ifdef _PARALLAXMAP
+ #include "PoiParallax.cginc"
+ #endif
+
+ #ifdef _REQUIRE_UV2
+ #include "PoiMirror.cginc"
+ #endif
+
+ #include "PoiData.cginc"
+
+ #ifdef _SUNDISK_NONE
+ #include "PoiRandom.cginc"
+ #endif
+
+ #ifdef _ALPHABLEND_ON
+ #include "PoiDissolve.cginc"
+ #endif
+
+ #include "PoiMainTex.cginc"
+
+ #ifdef _DETAIL_MULX2
+ #include "PoiPanosphere.cginc"
+ #endif
+
+ #ifdef _NORMALMAP
+ #include "PoiLighting.cginc"
+ #endif
+
+ #ifdef _FADING_ON
+ #include "PoiFlipbook.cginc"
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #include "PoiRimlighting.cginc"
+ #endif
+
+ #ifdef _METALLICGLOSSMAP
+ #include "PoiMetal.cginc"
+ #endif
+
+ #ifdef _COLORADDSUBDIFF_ON
+ #include "PoiMatcap.cginc"
+ #endif
+
+ #ifdef _SPECGLOSSMAP
+ #include "PoiSpecular.cginc"
+ #endif
+
+ #ifdef _TERRAIN_NORMAL_MAP
+ #include "PoiSubsurfaceScattering.cginc"
+ #endif
+
+ #ifdef REFRACTIVE
+ #include "PoiRefraction.cginc"
+ #endif
+
+ #ifdef _EMISSION
+ #include "PoiEmission.cginc"
+ #endif
+
+ #ifdef _COLORCOLOR_ON
+ #include "PoiClearCoat.cginc"
+ #endif
+
+ #ifdef _COLOROVERLAY_ON
+ #include "PoiDebug.cginc"
+ #endif
+
+ #include "PoiVert.cginc"
+ #include "PoiFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPass.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPass.cginc.meta
new file mode 100644
index 00000000..7861c813
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPass.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 24c1e0662686fea48b07d7a8097d3e16
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassOutline.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassOutline.cginc
new file mode 100644
index 00000000..389f5799
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassOutline.cginc
@@ -0,0 +1,15 @@
+#ifndef POI_PASS_OUTLINE
+ #define POI_PASS_OUTLINE
+ #include "Poicludes.cginc"
+ #include "PoiHelpers.cginc"
+ #include "PoiDissolve.cginc"
+ #include "PoiMainTex.cginc"
+ #include "PoiData.cginc"
+ #ifdef _SUNDISK_NONE
+ #include "PoiRandom.cginc"
+ #endif
+ #include "poiMirror.cginc"
+ #include "PoiLighting.cginc"
+ #include "PoiOutlineVert.cginc"
+ #include "PoiOutlineFrag.cginc"
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassOutline.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassOutline.cginc.meta
new file mode 100644
index 00000000..d57c1daf
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassOutline.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bf5af5e3b880bc44c942f56187887dc5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassShadow.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassShadow.cginc
new file mode 100644
index 00000000..dc6b2c7a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassShadow.cginc
@@ -0,0 +1,17 @@
+#ifndef POI_PASS_SHADOW
+ #define POI_PASS_SHADOW
+
+ #pragma multi_compile_shadowcaster
+ #include "UnityCG.cginc"
+ #include "UnityShaderVariables.cginc"
+ #include "PoiShadowIncludes.cginc"
+ #include "PoiHelpers.cginc"
+ #include "poiMirror.cginc"
+ #ifdef _SUNDISK_NONE
+ #include "PoiRandom.cginc"
+ #endif
+ #include "PoiDissolve.cginc"
+ #include "PoiShadowVert.cginc"
+ #include "PoiShadowFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassShadow.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassShadow.cginc.meta
new file mode 100644
index 00000000..9e80d7ae
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiPassShadow.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b0ff2d1983dc4e540bbbe48386283bf2
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRandom.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRandom.cginc
new file mode 100644
index 00000000..6473b764
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRandom.cginc
@@ -0,0 +1,39 @@
+#ifndef POI_RANDOM
+ #define POI_RANDOM
+
+ float _EnableRandom;
+ float m_start_Angle;
+ uint _AngleType;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin, _CameraAngleMax;
+ float _ModelAngleMin, _ModelAngleMax;
+ float _AngleMinAlpha;
+ uint _AngleCompareTo;
+
+ float ApplyAngleBasedRendering(float3 modelPos, float3 worldPos)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? modelPos : worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection)));
+ half cameraLookAtModel = remapClamped(.5 * dot(cameraToModelDirection, getCameraForward()) + .5, cameraAngleMax, cameraAngleMin, 0, 1);
+ half modelLookAtCamera = remapClamped(.5 * dot(-cameraToModelDirection, modelForwardDirection) + .5, modelAngleMax, modelAngleMin, 0, 1);
+ if (_AngleType == 0)
+ {
+ return max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if(_AngleType == 1)
+ {
+ return max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if(_AngleType == 2)
+ {
+ return max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ return 1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRandom.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRandom.cginc.meta
new file mode 100644
index 00000000..d7b42455
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRandom.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 428cdb5642de8b34982be94f8c522bbc
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRefraction.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRefraction.cginc
new file mode 100644
index 00000000..d0b9fbed
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRefraction.cginc
@@ -0,0 +1,50 @@
+#ifndef REFRACTION
+ #define REFRACTION
+
+ sampler2D _PoiGrab;
+ float _RefractionIndex;
+ float _RefractionOpacity;
+ float _RefractionChromaticAberattion;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RefractionOpacityMask); float4 _RefractionOpacityMask_ST;
+
+ float3 refraction;
+ float refractionOpacityMask;
+
+ inline float4 Refraction(v2f i, float indexOfRefraction, float chromaticAberration)
+ {
+ float4 screenPos = i.screenPos;
+ #if UNITY_UV_STARTS_AT_TOP
+ float scale = -1.0;
+ #else
+ float scale = 1.0;
+ #endif
+ float halfPosW = screenPos.w * 0.5;
+ screenPos.y = (screenPos.y - halfPosW) * _ProjectionParams.x * scale + halfPosW;
+ #if SHADER_API_D3D9 || SHADER_API_D3D11
+ screenPos.w += 0.00000000001;
+ #endif
+ float2 projScreenPos = (screenPos / screenPos.w).xy;
+ float3 worldViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos));
+ float3 refractionOffset = ((((indexOfRefraction - 1.0) * mul(UNITY_MATRIX_V, float4(poiMesh.fragmentNormal, 0.0))) * (1.0 / (screenPos.z + 1.0))) * (1.0 - dot(poiMesh.fragmentNormal, worldViewDir)));
+ float2 cameraRefraction = float2(refractionOffset.x, - (refractionOffset.y * _ProjectionParams.x));
+ //return tex2D(_PoiGrab, (projScreenPos + cameraRefraction));
+
+ float4 redAlpha = tex2D(_PoiGrab, (projScreenPos + cameraRefraction));
+ float green = tex2D(_PoiGrab, (projScreenPos + (cameraRefraction * (1.0 - chromaticAberration)))).g;
+ float blue = tex2D(_PoiGrab, (projScreenPos + (cameraRefraction * (1.0 + chromaticAberration)))).b;
+ return float4(redAlpha.r, green, blue, redAlpha.a);
+ }
+
+ void calculateRefraction(v2f i)
+ {
+ refraction = Refraction(i, _RefractionIndex, _RefractionChromaticAberattion).rgb;
+ refractionOpacityMask = UNITY_SAMPLE_TEX2D_SAMPLER(_RefractionOpacityMask, _MainTex, TRANSFORM_TEX(i.uv, _RefractionOpacityMask));
+ }
+
+ void applyRefraction(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(refraction * finalColor, finalColor, finalColor.a * alphaMask);
+ finalColor.a = 1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRefraction.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRefraction.cginc.meta
new file mode 100644
index 00000000..8b63c980
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRefraction.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b9e2f8418313be440b5720a5380f463e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRimLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRimLighting.cginc
new file mode 100644
index 00000000..2f787bb4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRimLighting.cginc
@@ -0,0 +1,95 @@
+#ifndef POI_RIM
+ #define POI_RIM
+
+ float4 _RimLightColor;
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimLightColorBias;
+ float4 _RimTexPanSpeed;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimBrighten;
+
+ //enviro rim
+ float _EnableEnvironmentalRim;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RimEnviroMask); float4 _RimEnviroMask_ST;
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RimTex); float4 _RimTex_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RimMask); float4 _RimMask_ST;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RimWidthNoiseTexture); float4 _RimWidthNoiseTexture_ST;
+ float _RimWidthNoiseStrength;
+ float4 _RimWidthNoisePan;
+
+ float4 rimColor = float4(0, 0, 0, 0);
+ float rim = 0;
+
+ void calculateRimLighting()
+ {
+ _RimWidthNoiseTexture_ST.zw += _Time.y * _RimWidthNoisePan.xy;
+ float rimNoise = UNITY_SAMPLE_TEX2D_SAMPLER(_RimWidthNoiseTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _RimWidthNoiseTexture));
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ poiCam.viewDotNormal = 1 - poiCam.viewDotNormal;
+ }
+ _RimWidth -= rimNoise;
+ float rimMask = UNITY_SAMPLE_TEX2D_SAMPLER(_RimMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _RimMask));
+ rimColor = UNITY_SAMPLE_TEX2D_SAMPLER(_RimTex, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _RimTex) + _Time.y * _RimTexPanSpeed.xy) * _RimLightColor;
+ _RimWidth = lerp(_RimWidth, _RimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix);
+ rim = 1 - smoothstep(min(_RimSharpness, _RimWidth), _RimWidth, poiCam.viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+ }
+
+ void applyRimColor(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor.rgb, lerp(finalColor.rgb, rimColor, _RimLightColorBias) + lerp(finalColor.rgb, rimColor, _RimLightColorBias) * _RimBrighten, rim);
+ }
+ void ApplyRimEmission(inout float4 finalColor)
+ {
+ finalColor.rgb += rim * lerp(finalColor.rgb, rimColor, _RimLightColorBias) * _RimStrength;
+ }
+
+ void applyEnviroRim(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if(_EnableEnvironmentalRim)
+ {
+ float enviroRimAlpha = saturate(1 - smoothstep(min(_RimEnviroSharpness, _RimEnviroWidth), _RimEnviroWidth, poiCam.viewDotNormal));
+ _RimEnviroBlur *= 1.7 - 0.7 * _RimEnviroBlur;
+
+ float3 enviroRimColor = 0;
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ //Probe 1
+ float4 reflectionData0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.fragmentNormal, _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.fragmentNormal, _RimEnviroBlur * UNITY_SPECCUBE_LOD_STEPS);
+ float3 reflectionColor1 = DecodeHDR(reflectionData1, unity_SpecCube1_HDR);
+
+ enviroRimColor = lerp(reflectionColor1, reflectionColor0, interpolator);
+ }
+ else
+ {
+ float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.fragmentNormal, _RimEnviroBlur * UNITY_SPECCUBE_LOD_STEPS);
+ enviroRimColor = DecodeHDR(reflectionData, unity_SpecCube0_HDR);
+ }
+
+ half enviroMask = poiMax(UNITY_SAMPLE_TEX2D_SAMPLER(_RimEnviroMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _RimEnviroMask)).rgb);
+ finalColor.rgb += lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * albedo.rgb), enviroRimAlpha).rgb * enviroMask;
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRimLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRimLighting.cginc.meta
new file mode 100644
index 00000000..beb87396
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiRimLighting.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3d196cf8209464f499f85f52ebc89bb8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowFrag.cginc
new file mode 100644
index 00000000..7f504e4c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowFrag.cginc
@@ -0,0 +1,44 @@
+#ifndef SHADOW_FRAG
+ #define SHADOW_FRAG
+
+ float2 _MainDistanceFade;
+ float _ForceOpaque;
+ half4 fragShadowCaster(
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ VertexOutputShadowCaster i
+ #endif
+ ): SV_Target
+ {
+ #ifdef POI_MIRROR
+ applyMirrorRenderFrag();
+ #endif
+
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ half alpha = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex)).a;
+ alpha *= smoothstep(_MainDistanceFade.x, _MainDistanceFade.y, distance(i.modelPos, _WorldSpaceCameraPos));
+ half alphaMask = tex2D(_AlphaMask, TRANSFORM_TEX(i.uv, _AlphaMask));
+
+ #ifdef POI_DISSOLVE
+ alpha *= calculateShadowDissolveAlpha(i.worldPos, i.localPos, i.uv);
+ #endif
+
+ #ifdef POI_RANDOM
+ alpha *= i.angleAlpha;
+ #endif
+
+ #ifdef CUTOUT
+ clip(alpha * alphaMask - _Clip);
+ UNITY_BRANCH
+ if (!_ForceOpaque)
+ {
+ clip(_Color.a - .75);
+ }
+ #endif
+ #ifdef TRANSPARENT
+ clip(alpha * alphaMask * _Color.a - 0.99);
+ #endif
+ #endif
+ SHADOW_CASTER_FRAGMENT(i)
+ }
+
+ #endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowFrag.cginc.meta
new file mode 100644
index 00000000..1db33353
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowFrag.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b00e388b635889144a85434f7d9747e4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowIncludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowIncludes.cginc
new file mode 100644
index 00000000..f2fdb268
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowIncludes.cginc
@@ -0,0 +1,33 @@
+#ifndef SHADOW_INCLUDES
+ #define SHADOW_INCLUDES
+
+ #define UNITY_STANDARD_USE_SHADOW_UVS 1
+
+ float4 _Color;
+ float _Clip;
+ UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST;
+ float4 _GlobalPanSpeed;
+ sampler2D _AlphaMask; float4 _AlphaMask_ST;
+
+ struct VertexInput
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float2 uv0: TEXCOORD0;
+ };
+
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ struct VertexOutputShadowCaster
+ {
+ V2F_SHADOW_CASTER_NOPOS
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ float2 uv: TEXCOORD1;
+ #endif
+ float3 modelPos: TEXCOORD2;
+ float3 worldPos: TEXCOORD3;
+ float3 localPos: TEXCOORD4;
+ float3 angleAlpha: TEXCOORD5;
+ };
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowIncludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowIncludes.cginc.meta
new file mode 100644
index 00000000..39a08379
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowIncludes.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2accc6aa74edc854ea1a4e9ae7e0d50c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowVert.cginc
new file mode 100644
index 00000000..7c1530e0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowVert.cginc
@@ -0,0 +1,18 @@
+void vertShadowCaster(VertexInput v,
+#if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ out VertexOutputShadowCaster o,
+#endif
+out float4 opos: SV_POSITION)
+{
+ TRANSFER_SHADOW_CASTER_NOPOS(o, opos)
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ o.uv = TRANSFORM_TEX(v.uv0 + _GlobalPanSpeed.xy * float2(_Time.y, _Time.y), _MainTex);
+ #endif
+ o.localPos = v.vertex;
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ o.angleAlpha = 1;
+ #ifdef POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowVert.cginc.meta
new file mode 100644
index 00000000..ad429ee3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiShadowVert.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 47e9da9ff9584eb4cbdab7d953837bb6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSpecular.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSpecular.cginc
new file mode 100644
index 00000000..acf24f56
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSpecular.cginc
@@ -0,0 +1,207 @@
+#ifndef POI_SPECULAR
+ #define POI_SPECULAR
+ int _SpecWhatTangent;
+ int _SpecularType;
+ int _SmoothnessFrom;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_SpecularMap); float4 _SpecularMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ShiftTexture); float4 _ShiftTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_AnisoTangentMap); float4 _AnisoTangentMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_SpecularMask); float4 _SpecularMask_ST;
+ float4 _SpecularTint;
+ float _SpecularSmoothness;
+ float _Spec1Offset;
+ float _Spec1JitterStrength;
+ float _Spec2Smoothness;
+ float _Spec2Offset;
+ float _Spec2JitterStrength;
+ float _AnisoUseTangentMap;
+ float _AnisoSpec1Alpha;
+ float _AnisoSpec2Alpha;
+ float _SpecularInvertSmoothness;
+ half _SpecularMixAlbedoIntoTint;
+ // Toon
+ half4 _SpecularToonInnerOuter;
+
+ // Globals
+ half3 finalSpecular;
+ float shiftTexture;
+ float3 tangentDirectionMap;
+ float4 specularMap;
+ UnityIndirect ZeroIndirect()
+ {
+ UnityIndirect ind;
+ ind.diffuse = 0;
+ ind.specular = 0;
+ return ind;
+ }
+
+ // From unity just putting it here in case I want to mod it
+ half4 poiRealisticSpecular(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness,
+ float3 normal,
+ UnityLight light, UnityIndirect gi)
+ {
+ float perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness);
+ #define UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV 0
+
+ #if UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV
+ half shiftAmount = dot(normal, poiCam.viewDir);
+ normal = shiftAmount < 0.0f ? normal + poiCam.viewDir * (-shiftAmount + 1e-5f): normal;
+ float nv = saturate(dot(normal, poiCam.viewDir));
+ #else
+ half nv = abs(dot(normal, poiCam.viewDir));
+ #endif
+
+ float nl = saturate(dot(normal, light.dir));
+ float nh = saturate(dot(normal, poiLight.halfDir));
+
+ half lv = saturate(dot(light.dir, poiCam.viewDir));
+ half lh = saturate(dot(light.dir, poiLight.halfDir));
+
+ half diffuseTerm = DisneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;
+
+ float roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
+
+ roughness = max(roughness, 0.002);
+ float V = SmithJointGGXVisibilityTerm(nl, nv, roughness);
+ float D = GGXTerm(nh, roughness);
+
+ float specularTerm = V * D * UNITY_PI;
+
+ #ifdef UNITY_COLORSPACE_GAMMA
+ specularTerm = sqrt(max(1e-4h, specularTerm));
+ #endif
+
+ specularTerm = max(0, specularTerm * nl);
+ #if defined(_POI_SPECULARHIGHLIGHTS_OFF)
+ specularTerm = 0.0;
+ #endif
+
+ half surfaceReduction;
+ #ifdef UNITY_COLORSPACE_GAMMA
+ surfaceReduction = 1.0 - 0.28 * roughness * perceptualRoughness;
+ #else
+ surfaceReduction = 1.0 / (roughness * roughness + 1.0);
+ #endif
+
+ specularTerm *= any(specColor) ? 1.0: 0.0;
+
+ half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity));
+ half3 color = diffColor * (gi.diffuse + light.color * diffuseTerm)
+ + specularTerm * light.color * FresnelTerm(specColor, lh)
+ + surfaceReduction * gi.specular * FresnelLerp(specColor, grazingTerm, nv);
+
+ return half4(color, 1);
+ }
+
+ void calculateRealisticSpecular(float4 albedo, float2 uv)
+ {
+
+ half oneMinusReflectivity;
+
+ UnityLight unityLight;
+ unityLight.color = poiLight.color;
+ unityLight.dir = poiLight.direction;
+ unityLight.ndotl = poiLight.nDotL;
+
+ UNITY_BRANCH
+ if (_SmoothnessFrom == 0)
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specularMap.rgb * _SpecularTint.rgb, /*out*/ oneMinusReflectivity);
+ finalSpecular = poiRealisticSpecular(diffColor, specularMap.rgb, oneMinusReflectivity, specularMap.a * _SpecularSmoothness * lerp(1,-1,_SpecularInvertSmoothness), poiMesh.fragmentNormal, unityLight, ZeroIndirect());
+ }
+ else
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, _SpecularTint.rgb, /*out*/ oneMinusReflectivity);
+ float smoothness = max(max(specularMap.r, specularMap.g), specularMap.b);
+ finalSpecular = poiRealisticSpecular(diffColor, 1, oneMinusReflectivity, smoothness * _SpecularSmoothness * lerp(1,-1,_SpecularInvertSmoothness), poiMesh.fragmentNormal, unityLight, ZeroIndirect());
+ }
+ finalSpecular *= lerp(1, albedo.rgb, _SpecularMixAlbedoIntoTint);
+ }
+
+ void calculateToonSpecular(float4 albedo, float2 uv)
+ {
+ /*
+ finalSpecular = 1;
+ calculateRealisticSpecular(albedo, uv);
+ float specIntensity = dot(finalSpecular.rgb, grayscale_for_light());
+ finalSpecular.rgb = smoothstep(0.99, 1, specIntensity) * poiLight.color.rgb * poiLight.attenuation;
+ */
+ finalSpecular = smoothstep(1 - _SpecularToonInnerOuter.y, 1 - _SpecularToonInnerOuter.x, dot(poiLight.halfDir, poiMesh.fragmentNormal) * poiLight.attenuation) * poiLight.color.rgb;
+ UNITY_BRANCH
+ if (_SmoothnessFrom == 0)
+ {
+ finalSpecular.rgb *= specularMap.rgb * lerp(1, albedo.rgb, _SpecularMixAlbedoIntoTint);
+ finalSpecular *= specularMap.a;
+ }
+ else
+ {
+ finalSpecular *= specularMap.r * lerp(1, albedo.rgb, _SpecularMixAlbedoIntoTint);
+ }
+ }
+
+ float3 strandSpecular(float TdotL, float TdotV, float specPower)
+ {
+ float Specular = saturate(poiLight.nDotL) * pow(saturate(sqrt(1.0 - (TdotL * TdotL)) * sqrt(1.0 - (TdotV * TdotV)) - TdotL * TdotV), specPower);
+ half normalization = sqrt((specPower + 1) * ((specPower) + 1)) / (8 * pi);//
+ Specular *= normalization;
+ return Specular;
+ }
+
+ void AnisotropicSpecular()
+ {
+ float3 tangentOrBitangent = _SpecWhatTangent ? poiMesh.tangent: poiMesh.bitangent;
+
+
+ float4 packedTangentMap = UNITY_SAMPLE_TEX2D_SAMPLER(_AnisoTangentMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _AnisoTangentMap));
+ float3 normalLocalAniso = lerp(float3(0, 0, 1), UnpackNormal(packedTangentMap), _AnisoUseTangentMap);
+ normalLocalAniso = BlendNormals(normalLocalAniso, poiMesh.tangentSpaceNormal);
+ //float3 normalDirection = normalize(mul(poiMesh.fragmentNormal, poiTData.tangentTransform));
+ float3 normalDirectionAniso = Unity_SafeNormalize(mul(normalLocalAniso, poiTData.tangentTransform));
+ float3 tangentDirection = mul(poiTData.tangentTransform, tangentOrBitangent).xyz;
+ float3 viewReflectDirectionAniso = reflect(-poiCam.viewDir, normalDirectionAniso); // possible bad negation
+ tangentDirectionMap = mul(poiTData.tangentToWorld, float3(normalLocalAniso.rg, 0.0)).xyz;
+ tangentDirectionMap = normalize(lerp(tangentOrBitangent, tangentDirectionMap, _AnisoUseTangentMap));
+ float TdotL = dot(poiLight.direction, tangentDirectionMap);
+ float TdotV = dot(poiCam.viewDir, tangentDirectionMap);
+ float TdotH = dot(poiLight.halfDir, tangentDirectionMap);
+ half specPower = RoughnessToSpecPower(1.0 - _SpecularSmoothness * specularMap.a);
+ half spec2Power = RoughnessToSpecPower(1.0 - _Spec2Smoothness * specularMap.a);
+ half Specular = 0;
+
+ float3 spec = strandSpecular(TdotL, TdotV, specPower) * _AnisoSpec1Alpha;
+ float3 spec2 = strandSpecular(TdotL, TdotV, spec2Power) * _AnisoSpec2Alpha;
+
+ finalSpecular = max(spec, spec2) * specularMap.rgb * _SpecularTint.a * poiLight.color * lerp(1, albedo.rgb, _SpecularMixAlbedoIntoTint);
+ }
+
+ void calculateSpecular(float4 albedo)
+ {
+ specularMap = UNITY_SAMPLE_TEX2D_SAMPLER(_SpecularMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _SpecularMap));
+
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+ {
+ calculateRealisticSpecular(albedo, poiMesh.uv[0]);
+ finalSpecular *= poiLight.attenuation;
+ }
+ UNITY_BRANCH
+ if (_SpecularType == 2) // Toon
+ {
+ calculateToonSpecular(albedo, poiMesh.uv[0]);
+ }
+ UNITY_BRANCH
+ if (_SpecularType == 3) // anisotropic
+ {
+ AnisotropicSpecular();
+ }
+ }
+
+ void applySpecular(inout float4 finalColor)
+ {
+ half specularMask = UNITY_SAMPLE_TEX2D_SAMPLER(_SpecularMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _SpecularMask)).r;
+ finalSpecular *= _SpecularTint.a;
+ finalSpecular = finalSpecular.rgb * _SpecularTint.rgb * saturate(poiMax(poiLight.color.rgb));
+ finalColor.rgb += finalSpecular * specularMask;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSpecular.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSpecular.cginc.meta
new file mode 100644
index 00000000..0b0570cb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSpecular.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 0fb2e921a4d806742a0096c3041686e2
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSubsurfaceScattering.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSubsurfaceScattering.cginc
new file mode 100644
index 00000000..b290d7e3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSubsurfaceScattering.cginc
@@ -0,0 +1,35 @@
+#ifndef SUBSURFACE
+ #define SUBSURFACE
+
+ float _SSSThicknessMod;
+ float _SSSStrength;
+ float _SSSPower;
+ float _SSSDistortion;
+ float4 _SSSColor;
+ float _EnableSSS;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_SSSThicknessMap); float4 _SSSThicknessMap_ST;
+
+ float3 finalSSS;
+
+ void calculateSubsurfaceScattering()
+ {
+ float SSS = 1 - UNITY_SAMPLE_TEX2D_SAMPLER(_SSSThicknessMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _SSSThicknessMap));
+
+ half3 vLTLight = poiLight.direction + poiMesh.vertexNormal * _SSSDistortion;
+ half flTDot = pow(saturate(dot(poiCam.viewDir, -vLTLight)), _SSSPower) * _SSSStrength;
+ #ifdef FORWARD_BASE_PASS
+ half3 fLT = (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #else
+ half3 fLT = poiLight.attenuation * (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #endif
+
+ finalSSS = fLT;
+ }
+
+ void applySubsurfaceScattering(inout float4 finalColor)
+ {
+ finalColor.rgb += finalSSS * poiLight.color * albedo * _SSSColor;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSubsurfaceScattering.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSubsurfaceScattering.cginc.meta
new file mode 100644
index 00000000..da20e3d5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiSubsurfaceScattering.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: df02917e60a4c134d854d059c784e6b9
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiTouch.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiTouch.cginc
new file mode 100644
index 00000000..ada341f3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiTouch.cginc
@@ -0,0 +1,33 @@
+#ifndef POI_TOUCH
+ #define POI_TOUCH
+
+ sampler2D _BulgeMask;
+ sampler2D _CameraDepthTexture;
+ float _BuldgeFadeLength;
+ float _BuldgeHeight;
+
+ void bulgyWolgy(inout v2f o)
+ {
+ float depth = DecodeFloatRG(tex2Dlod(_CameraDepthTexture, float4(o.screenPos.xy / o.screenPos.w, 0, 0)));
+ float bulgeMask = tex2Dlod(_BulgeMask, float4(o.uv, 0, 0));
+ depth = Linear01Depth(depth);
+
+ float intersect = 0;
+ if (depth != 1)
+ {
+ float diff = distance(depth, Linear01Depth(o.pos.z / o.pos.w));
+ if(diff > 0)
+ {
+ intersect = 1 - smoothstep(0, _ProjectionParams.w * _BuldgeFadeLength, diff);
+ }
+ }
+ float4 offset = intersect * _BuldgeHeight * float4(o.normal, 0);
+
+ offset = IsInMirror() ? 0 : offset;
+
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos) + offset;
+ o.localPos = mul(unity_WorldToObject, o.worldPos);
+ o.pos = UnityObjectToClipPos(o.localPos);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiTouch.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiTouch.cginc.meta
new file mode 100644
index 00000000..10b357eb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiTouch.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 752ee284ed2a5f54893460881e53e619
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiVert.cginc
new file mode 100644
index 00000000..4af8633c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiVert.cginc
@@ -0,0 +1,63 @@
+#ifndef POI_VERT
+ #define POI_VERT
+
+ void ComputeVertexLightColor(inout v2f i)
+ {
+ #if defined(VERTEXLIGHT_ON)
+ i.vertexLightColor = Shade4PointLights(
+ unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0,
+ unity_LightColor[0].rgb, unity_LightColor[1].rgb,
+ unity_LightColor[2].rgb, unity_LightColor[3].rgb,
+ unity_4LightAtten0, i.worldPos, i.normal
+ );
+ #endif
+ }
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ UNITY_INITIALIZE_OUTPUT(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderVert(v.vertex);
+ #endif
+
+ TANGENT_SPACE_ROTATION;
+ o.localPos = v.vertex;
+ o.pos = UnityObjectToClipPos(o.localPos);
+ o.screenPos = ComputeScreenPos(o.pos);
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ o.uv0 = v.uv0.xy;
+ o.uv1 = v.uv1.xy;
+ o.uv2 = v.uv2.xy;
+ o.uv3 = v.uv3.xy;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = normalize(mul(unity_ObjectToWorld, float4(v.tangent.xyz, 0.0)).xyz);
+ o.bitangent = normalize(cross(o.normal, o.tangent) * v.tangent.w);
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+
+ #ifdef POI_TOUCH
+ bulgyWolgy(o);
+ #endif
+
+ o.angleAlpha = 1;
+ #ifdef POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+ float3x3 objectToTangent = float3x3(
+ v.tangent.xyz,
+ cross(v.normal, v.tangent.xyz) * v.tangent.w,
+ v.normal
+ );
+ o.tangentViewDir = mul(objectToTangent, ObjSpaceViewDir(v.vertex));
+
+ UNITY_TRANSFER_SHADOW(o, o.uv0);
+ UNITY_TRANSFER_FOG(o, o.pos);
+ ComputeVertexLightColor(o);
+ return o;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiVert.cginc.meta
new file mode 100644
index 00000000..a13470ae
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/PoiVert.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8776894305708524da49f0d0841e51b8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/Poicludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/Poicludes.cginc
new file mode 100644
index 00000000..352a0533
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/Poicludes.cginc
@@ -0,0 +1,147 @@
+#ifndef POICLUDES
+ #define POICLUDES
+
+ #include "UnityCG.cginc"
+ #include "Lighting.cginc"
+ #include "UnityPBSLighting.cginc"
+ #include "AutoLight.cginc"
+
+ UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST;
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float4 color: COLOR;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ float3 normal: TEXCOORD4;
+ float3 tangent: TEXCOORD5;
+ float3 bitangent: TEXCOORD6;
+ float4 worldPos: TEXCOORD7;
+ float4 localPos: TEXCOORD8;
+ float4 screenPos: TEXCOORD9;
+ float3 tangentViewDir: TEXCOORD10;
+ float3 modelPos: TEXCOORD11;
+ float angleAlpha: TEXCOORD12;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ UNITY_SHADOW_COORDS(13)
+ UNITY_FOG_COORDS(14)
+ #if defined(VERTEXLIGHT_ON)
+ float3 vertexLightColor: TEXCOORD15;
+ #endif
+ };
+
+ #ifdef OUTLINE
+ float _LineWidth;
+ float _OutlineEmission;
+ float4 _LineColor;
+ sampler2D _OutlineTexture; float4 _OutlineTexture_ST;
+ float4 _OutlineTexturePan;
+
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+ #endif
+
+ struct PoiLighting
+ {
+ half3 direction;
+ half3 color;
+ half attenuation;
+ half3 directLighting;
+ half3 indirectLighting;
+ half lightMap;
+ half3 rampedLightMap;
+ half3 finalLighting;
+ half3 halfDir;
+ #if defined(VERTEXLIGHT_ON)
+ half3 vertexLightColor;
+ #endif
+ half nDotL;
+ half nDotH;
+ half lDotv;
+ half lDotH;
+ half nDotV;
+ half vNDotV;
+ half diffuseTerm;
+ };
+
+ struct PoiCamera
+ {
+ half3 viewDir;
+ half3 tangentViewDir;
+ half3 forwardDir;
+ half3 worldPos;
+ float viewDotNormal;
+ float distanceToModel;
+ float distanceToVert;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ };
+
+ struct PoiMesh
+ {
+ float3 vertexNormal;
+ float3 fragmentNormal;
+ float3 tangent;
+ float3 bitangent;
+ float3 localPos;
+ float3 worldPos;
+ float3 modelPos;
+ float3 tangentSpaceNormal;
+ float2 uv[4];
+ };
+
+ struct PoiTangentData
+ {
+ float3x3 tangentTransform;
+ float3x3 tangentToWorld;
+ };
+
+ struct FragmentCommonData
+ {
+ half3 diffColor, specColor;
+ // Note: smoothness & oneMinusReflectivity for optimization purposes, mostly for DX9 SM2.0 level.
+ // Most of the math is being done on these (1-x) values, and that saves a few precious ALU slots.
+ half oneMinusReflectivity, smoothness;
+ float3 normalWorld;
+ float3 eyeVec;
+ half alpha;
+ float3 posWorld;
+
+ #if UNITY_STANDARD_SIMPLE
+ half3 reflUVW;
+ #endif
+
+ #if UNITY_STANDARD_SIMPLE
+ half3 tangentSpaceNormal;
+ #endif
+ };
+
+ static PoiLighting poiLight;
+ static PoiCamera poiCam;
+ static PoiMesh poiMesh;
+ static UnityGI gi;
+ static FragmentCommonData s;
+ static PoiTangentData poiTData;
+ float4 finalColor;
+ float4 mainTexture;
+ float4 albedo;
+ #define pi float(3.14159265359)
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/Poicludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/Poicludes.cginc.meta
new file mode 100644
index 00000000..594e0f3e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Includes/Poicludes.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e627afcc59d20744191e9c16f68157ae
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon.meta
new file mode 100644
index 00000000..dea61ae0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5cc6e5e463427654b9ac97911a0bb36a
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonCutout.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonCutout.shader
new file mode 100644
index 00000000..a5bd70fa
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonCutout.shader
@@ -0,0 +1,667 @@
+Shader ".poiyomi/Patreon/Particle2/Outline Cutout"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#ff0000ff>❤</color> <color=#000000ff>Poiyomi Toon Shader V4.2</color> <color=#ff0000ff>❤</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _Saturation ("Saturation", Range(-1, 1)) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ _MainTex ("Texture", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("Tex UV#", Int) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [Vector2]_MainNormalPan ("Normal Pan", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Mask", 2D) = "white" { }
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.5
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 1
+ [Vector2]_GlobalPanSpeed ("Global Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_DetailOptions ("Details", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailTexUV ("Detail Tex UV#", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Vector2]_DetailTexturePan ("Detail Tex Pan", Vector) = (0, 0, 0, 0)
+ _DetailTint ("Detail Tint", Color) = (1, 1, 1)
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailNormalUV ("Detail Normal UV#", Int) = 0
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [Vector2]_MainDetailNormalPan ("Detail Normal Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+ [HideInInspector] m_start_Fade ("Fade", Float) = 0
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainFadeTexture ("Fade Map", 2D) = "white" { }
+ [Vector2]_MainDistanceFade ("Distance Fade X to Y", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_Fade ("Fade", Float) = 0
+
+ // Particles Start
+ [HideInInspector] m_particleOptions ("Particles", Float) = 0
+ [ToggleUI]_ParticleLit ("Basic Lighting", Float) = 0
+ [HDR]_ParticleColor ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _ParticleTexture ("Texture", 2D) = "white" { }
+ [ToggleUI]_ParticleRandomRotation ("Random Rotation", Float) = 0
+ _ParticleRotation ("Rotation", Range(0, 360)) = 0
+ _ParticlePerCMSquared ("Particle/cm^2", Float) = 1
+ _ParticleAlphaCutoff ("Alpha Cutoff", Range(0, 1.001)) = 0
+ _ParticleMinRenderDistance ("Min Render Distance", Float) = .2
+ [Gradient]_ParticleStartColorGradient ("Color Range", 2D) = "white" { }
+ [ToggleUI]_ColorOverLifetime ("Color Over Lifetime?", Float) = 0
+ _ParticleMask ("Particle Mask", 2D) = "white" { }
+ [Enum(Spherical, 0, Linear, 1)] _ParticleMovementMode ("Movement Mode", Int) = 0
+
+ [HideInInspector] m_start_sphericalMotion ("Spherical Motion", Float) = 0
+ _ColorOverLifeSpeed ("Color/Life Speed", Float) = 1
+ _ParticleScaleMin ("Scale min", float) = 0.01
+ _ParticleScaleMax ("Scale max", float) = 0.02
+ _ParticleSphericalMinSpeed ("Min Speed", Float) = -5
+ _ParticleSphericalMaxSpeed ("Max Speed", Float) = 5
+ _ParticleSphericalMinRadius ("Min Radius", Float) = 0
+ _ParticleSphericalMaxRadius ("Max Radius", Float) = 0.2
+ [HideInInspector] m_end_sphericalMotion ("Spherical Movement", Float) = 0
+
+ [HideInInspector] m_start_LinearMotion ("Linear Movement", Float) = 0
+ _ParticleLinearEndOffsetMin ("End Offset Min", Vector) = (0.05, 0.05, 0.05, 0)
+ _ParticleLinearEndOffsetMax ("End Offset Max", Vector) = (-0.05, -0.05, -0.05, 0)
+ [ToggleUI]_ParticleFlipParticlesGoingInward ("Flip Particles Going Inward", Float) = 0
+ _ParticleLinearSpeedMin ("Min Speed", Float) = 0.1
+ _ParticleLinearSpeedMax ("Max Speed", Float) = 10
+ _ParticleLinearStartAlpha ("Start Alpha", Float) = 1
+ _ParticleLinearEndAlpha ("End Alpha", Float) = 1
+ _ParticleLinearStartSizeMin ("Start min Size", Float) = .02
+ _ParticleLinearStartSizeMax ("Start max Size", Float) = .02
+ _ParticleLinearEndSizeMin ("End min Size", Float) = 0
+ _ParticleLinearEndsizeMax ("End max Size", Float) = 0
+ _ParticleLinearNormalRange ("Normal Spawn Range", Range(-1, 1)) = -1
+ [HideInInspector] m_end_LinearMotion ("Linear Motion", Float) = 0
+
+ [HideInInspector] m_start_ParticleFlipbook ("Flipbook", Float) = 0
+ [ToggleUI]_EnableParticleFlipbook ("Enable Flipbook", Float) = 0
+ _ParticleFlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ _ParticleFlipbookTotalFrames ("Total Frames", Int) = 1
+ _ParticleFlipbookFPS ("FPS", Float) = 30.0
+ [ToggleUI]_ParticleRandomTimeOffset ("Random Starting Frame?", Float) = 0
+ [HideInInspector] m_start_manualParticleFlipbookControl ("Manual Control", Float) = 0
+ _ParticleFlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualParticleFlipbookControl ("Manual Control", Float) = 0
+ [HideInInspector] m_end_ParticleFlipbook ("Flipbook", Float) = 0
+ // Particles End
+
+ [HideInInspector] m_metallicOptions ("Metallic", Float) = 0
+ [Toggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [Toggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ _ClearCoatCubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearCoatSampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearCoatMask ("Mask", 2D) = "white" { }
+ _ClearCoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearCoatSmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [ToggleUI]_ClearCoatInvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ [HideInInspector] m_matcapOptions ("Matcap / Sphere Textures", Float) = 0
+ [Toggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask", 2D) = "white" { }
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ToggleUI]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask", 2D) = "white" { }
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ [HideInInspector] m_outlineOptions ("Outlines", Float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ [ToggleUI]_OutlineUseVertexColors ("V Color as Normal", Float) = 0
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color", Color) = (1, 1, 1, 1)
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _OutlineTexture ("Outline Texture", 2D) = "white" { }
+ _OutlineMask ("Outline Mask", 2D) = "white" { }
+ _OutlineTexturePan ("Texture XY | Mask ZW Pan", Vector) = (0, 0, 0, 0)
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ _OutlineRimLightBlend ("Rim Light Blend", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY", Vector) = (1, 0, 0, 0)
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ _OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_emissionOptions ("Emission / Glow", Float) = 0
+ [Toggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMapUV ("Emission UV#", Int) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ _EmissionMap ("Emission Map", 2D) = "white" { }
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ _EmissionPan ("Map(XY) | Mask(ZW) Pan", Vector) = (0, 0, 0, 0)
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ _EmissiveScroll_Direction ("Emissive Scroll Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Emissive Scroll Width", Float) = 10
+ _EmissiveScroll_Velocity ("Emissive Scroll Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Emissive Scroll Interval", Float) = 20
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ [HideInInspector] m_fakeLightingOptions ("Light & Shadow", Float) = 0
+ [Toggle(_NORMALMAP)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Natural, 0, Controlled, 1, Standardish, 2, Math, 3)] _LightingType ("Lighting Type", Int) = 1
+ [Gradient]_ToonRamp ("Lighting Ramp", 2D) = "white" { }
+ _LightingShadowMask ("Shadow Mask (R)", 2D) = "white" { }
+ _ShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ _ShadowOffset ("Shadow Offset", Range(-1, 1)) = 0
+ _AOMap ("AO Map", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingAOUV ("AO Map UV#", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 1
+ [HideInInspector] m_start_lightingAdvanced ("Advanced", Float) = 0
+ _IndirectContribution ("Indirect Contribution", Range(0, 1)) = 0
+ _AdditiveSoftness ("Additive Softness", Range(0, 0.5)) = 0.005
+ _AdditiveOffset ("Additive Offset", Range(-0.5, 0.5)) = 0
+ _AttenuationMultiplier ("Attenuation", Range(0, 1)) = 0
+ [HideInInspector] m_end_lightingAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_specularHighlightsOptions ("Specular Highlights", Float) = 0
+ [Toggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3)] _SpecularType ("Specular Type", Int) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMixAlbedoIntoTint ("Mix Material Color Into Tint", Range(0, 1)) = 0
+ _SpecularSmoothness ("Smoothness", Range(0, 1)) = 1
+ _SpecularMap ("Specular Map", 2D) = "white" { }
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ [HideInInspector] m_start_SpecularToon ("Toon", Float) = 0
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_SpecularToon ("Toon", Float) = 0
+ [HideInInspector] m_start_Anisotropic ("Anisotropic", Float) = 0
+ [Enum(Tangent, 0, Bitangent, 1)] _SpecWhatTangent ("(Bi)Tangent?", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha", Range(0, 1)) = 1
+ //_Spec1Offset ("Spec1 Offset", Float) = 0
+ //_Spec1JitterStrength ("Spec1 Jitter Strength", Float) = 1.0
+ _Spec2Smoothness ("Spec2 Smoothness", Range(0, 1)) = 0
+ //_Spec2Offset ("Spec2 Offset", Float) = 0
+ //_Spec2JitterStrength ("Spec2 Jitter Strength", Float) = 1.0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map", 2D) = "bump" { }
+ //_ShiftTexture ("Shift Texture", 2D) = "black" { }
+ [HideInInspector] m_end_Anisotropic ("Anisotropic", Float) = 0
+
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [Toggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightIterations ("Parallax Height Iterations", Range(1, 10)) = 1
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+
+ [HideInInspector] m_subsurfaceOptions ("Subsurface Scattering", Float) = 0
+ [Toggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 1, 1, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSStrength ("Attenuation", Range(0, 1)) = 0
+ _SSSPower ("Light Spread", Range(1, 100)) = 1
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 0
+
+ [HideInInspector] m_rimLightOptions ("Rim Lighting", Float) = 0
+ [Toggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [Vector2]_RimTexPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [ToggleUI]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [Vector2]_RimWidthNoisePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+
+ [HideInInspector] m_flipBook ("Flipbook", Float) = 0
+ [Toggle(_FADING_ON)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookUV ("Flipbook UV#", Int) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [Vector2]_FlipbookTexturePan ("Texture Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_FlipbookMaskPan ("Mask Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Int) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ //[ToggleUI]_FlipbookControlsAlpha ("Flipbook Controls Alpha", Float) = 0
+ /*
+ [HideInInspector] m_start_FlipbookOffsetLoop ("Offset Animation", Float) = 0
+ [Enum(Off, 0, Loop, 1, Bounce, 2, Smooth Bounce, 3)]_FlipbookMovementType ("Movement Type", Int) = 1
+ _FlipbookStartEndOffset ("Start & End Offset", Vector) = (0,0,0,0)
+ _FlipbookMovementSpeed ("Speed", Float) = 1.0
+ [HideInInspector] m_end_FlipbookOffsetLoop ("Offset Animation", Float) = 0
+ */
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+
+ [HideInInspector] m_dissolve ("Dissolve", Float) = 0
+ [Toggle(_ALPHABLEND_ON)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolve to Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolve to Texture", 2D) = "white" { }
+ _DissolveToEmissionStrength ("Dissolve to Emission Strength", Range(0, 20)) = 0
+ [Vector2]_DissolveToPanning ("Dissolve to Panning", Vector) = (0, 0, 0, 0)
+ _DissolveNoiseTexture ("Dissolve Noise", 2D) = "white" { }
+ [ToggleUI]_DissolveInvertNoise ("Invert Noise", Float) = 0
+ _DissolveDetailNoise ("Dissolve Detail Noise", 2D) = "black" { }
+ [ToggleUI]_DissolveInvertDetailNoise ("Invert Detail Noise", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolvePan ("Noise (XY) | Detail (ZW) Pan", Vector) = (0, 0, 0, 0)
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [Toggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMapTexture ("Mask", 2D) = "white" { }
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+
+
+ [HideInInspector] m_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+
+ [HideInInspector] m_start_ParticleStencilPassOptions ("Particle Stencil", Float) = 0
+ [IntRange] _ParticleStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ParticleStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_ParticleStencilPassOptions ("Particle Stencil", Float) = 0
+
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _OutlineStencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _OutlineStencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ [HideInInspector] m_mirrorOptions ("Mirror", Float) = 0
+ [Toggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+
+ [HideInInspector] m_RandomOptions ("Random", Float) = 0
+ [Toggle(_SUNDISK_NONE)]_EnableRandom ("Enable Random", Float) = 0
+ [HideInInspector] m_start_Angle ("Angular Rendering", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_Angle ("Angular Rendering", Float) = 0
+
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ _ZBias ("ZBias", Float) = 0.0
+
+ [HideInInspector] m_debugOptions ("Debug", Float) = 0
+ [Toggle(_COLOROVERLAY_ON)]_DebugDisplayDebug ("Display Debug Info", Float) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ }
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "DisableBatching" = "True" "RenderType" = "Opaque" "Queue" = "Geometry" }
+
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask On
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_BASE_PASS
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature _NORMALMAP
+ // Flipbook
+ #pragma shader_feature _FADING_ON
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_ADD_PASS
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature _NORMALMAP
+ // Flipbook
+ #pragma shader_feature _FADING_ON
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "Outline"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ Cull [_OutlineCull]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_BASE_PASS
+ #define OUTLINE
+ #pragma multi_compile_fwdbase
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Lighting
+ #pragma shader_feature _NORMALMAP
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma multi_compile_instancing
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPassOutline.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ParticlePass"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_ParticleStencilRef]
+ Comp [_ParticleStencilCompareFunction]
+ Pass [_ParticleStencilPassOp]
+ Fail [_ParticleStencilFailOp]
+ ZFail [_ParticleStencilZFailOp]
+ }
+ ZWrite On
+ Cull Back
+ AlphaToMask On
+
+ CGPROGRAM
+
+ #pragma target 4.0
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex particleVert
+ #pragma geometry particleGeom
+ #pragma fragment particleFrag
+ #include "../Includes/PoiParticlePass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define CUTOUT
+ #define POISHADOW
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/PoiPassShadow.cginc"
+ ENDCG
+
+ }
+ }
+ Fallback "Toon/Lit Cutout (Double)"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonCutout.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonCutout.shader.meta
new file mode 100644
index 00000000..bd0c3222
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonCutout.shader.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e230c350a15e81e4399c85e0281d79e4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonTransparent.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonTransparent.shader
new file mode 100644
index 00000000..35a016b0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonTransparent.shader
@@ -0,0 +1,671 @@
+Shader ".poiyomi/Patreon/Particle2/Outline Transparent"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#ff0000ff>❤</color> <color=#000000ff>Poiyomi Toon Shader V4.2</color> <color=#ff0000ff>❤</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _Saturation ("Saturation", Range(-1, 1)) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ _MainTex ("Texture", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("Tex UV#", Int) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [Vector2]_MainNormalPan ("Normal Pan", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Mask", 2D) = "white" { }
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.5
+ [Vector2]_GlobalPanSpeed ("Global Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_DetailOptions ("Details", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailTexUV ("Detail Tex UV#", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Vector2]_DetailTexturePan ("Detail Tex Pan", Vector) = (0, 0, 0, 0)
+ _DetailTint ("Detail Tint", Color) = (1, 1, 1)
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailNormalUV ("Detail Normal UV#", Int) = 0
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [Vector2]_MainDetailNormalPan ("Detail Normal Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+ [HideInInspector] m_start_Fade ("Fade", Float) = 0
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainFadeTexture ("Fade Map", 2D) = "white" { }
+ [Vector2]_MainDistanceFade ("Distance Fade X to Y", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_Fade ("Fade", Float) = 0
+
+ // Particles Start
+ [HideInInspector] m_particleOptions ("Particles", Float) = 0
+ [ToggleUI]_ParticleLit ("Basic Lighting", Float) = 0
+ [HDR]_ParticleColor ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _ParticleTexture ("Texture", 2D) = "white" { }
+ [ToggleUI]_ParticleRandomRotation ("Random Rotation", Float) = 0
+ _ParticleRotation ("Rotation", Range(0, 360)) = 0
+ _ParticlePerCMSquared ("Particle/cm^2", Float) = 1
+ _ParticleAlphaCutoff ("Alpha Cutoff", Range(0, 1.001)) = 0
+ _ParticleMinRenderDistance ("Min Render Distance", Float) = .2
+ [Gradient]_ParticleStartColorGradient ("Color Range", 2D) = "white" { }
+ [ToggleUI]_ColorOverLifetime ("Color Over Lifetime?", Float) = 0
+ _ParticleMask ("Particle Mask", 2D) = "white" { }
+ [Enum(Spherical, 0, Linear, 1)] _ParticleMovementMode ("Movement Mode", Int) = 0
+
+ [HideInInspector] m_start_sphericalMotion ("Spherical Motion", Float) = 0
+ _ColorOverLifeSpeed ("Color/Life Speed", Float) = 1
+ _ParticleScaleMin ("Scale min", float) = 0.01
+ _ParticleScaleMax ("Scale max", float) = 0.02
+ _ParticleSphericalMinSpeed ("Min Speed", Float) = -5
+ _ParticleSphericalMaxSpeed ("Max Speed", Float) = 5
+ _ParticleSphericalMinRadius ("Min Radius", Float) = 0
+ _ParticleSphericalMaxRadius ("Max Radius", Float) = 0.2
+ [HideInInspector] m_end_sphericalMotion ("Spherical Movement", Float) = 0
+
+ [HideInInspector] m_start_LinearMotion ("Linear Movement", Float) = 0
+ _ParticleLinearEndOffsetMin ("End Offset Min", Vector) = (0.05, 0.05, 0.05, 0)
+ _ParticleLinearEndOffsetMax ("End Offset Max", Vector) = (-0.05, -0.05, -0.05, 0)
+ [ToggleUI]_ParticleFlipParticlesGoingInward ("Flip Particles Going Inward", Float) = 0
+ _ParticleLinearSpeedMin ("Min Speed", Float) = 0.1
+ _ParticleLinearSpeedMax ("Max Speed", Float) = 10
+ _ParticleLinearStartAlpha ("Start Alpha", Float) = 1
+ _ParticleLinearEndAlpha ("End Alpha", Float) = 1
+ _ParticleLinearStartSizeMin ("Start min Size", Float) = .02
+ _ParticleLinearStartSizeMax ("Start max Size", Float) = .02
+ _ParticleLinearEndSizeMin ("End min Size", Float) = 0
+ _ParticleLinearEndsizeMax ("End max Size", Float) = 0
+ _ParticleLinearNormalRange ("Normal Spawn Range", Range(-1, 1)) = -1
+ [HideInInspector] m_end_LinearMotion ("Linear Motion", Float) = 0
+
+ [HideInInspector] m_start_ParticleFlipbook("Flipbook", Float) = 0
+ [ToggleUI]_EnableParticleFlipbook("Enable Flipbook", Float) = 0
+ _ParticleFlipbookTexArray ("Texture Array", 2DArray) = "" {}
+ _ParticleFlipbookTotalFrames ("Total Frames", Int) = 1
+ _ParticleFlipbookFPS ("FPS", Float) = 30.0
+ [ToggleUI]_ParticleRandomTimeOffset("Random Starting Frame?", Float) = 0
+ [HideInInspector] m_start_manualParticleFlipbookControl ("Manual Control", Float) = 0
+ _ParticleFlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualParticleFlipbookControl ("Manual Control", Float) = 0
+ [HideInInspector] m_end_ParticleFlipbook ("Flipbook", Float) = 0
+ // Particles End
+
+ [HideInInspector] m_metallicOptions ("Metallic", Float) = 0
+ [Toggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [Toggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ _ClearCoatCubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearCoatSampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearCoatMask ("Mask", 2D) = "white" { }
+ _ClearCoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearCoatSmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [ToggleUI]_ClearCoatInvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ [HideInInspector] m_matcapOptions ("Matcap / Sphere Textures", Float) = 0
+ [Toggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask", 2D) = "white" { }
+ _MatcapEmissionStrength ("Emission Strength", Range(0,20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ToggleUI]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask", 2D) = "white" { }
+ _Matcap2EmissionStrength ("Emission Strength", Range(0,20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ [HideInInspector] m_outlineOptions ("Outlines", Float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ [ToggleUI]_OutlineUseVertexColors ("V Color as Normal", Float) = 0
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color", Color) = (1, 1, 1, 1)
+ _OutlineTintMix ("Tint Mix", Range(0,1)) = 1
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _OutlineTexture ("Outline Texture", 2D) = "white" { }
+ _OutlineMask ("Outline Mask", 2D) = "white" { }
+ _OutlineTexturePan ("Outline Texture Pan", Vector) = (0, 0, 0, 0)
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ _OutlineRimLightBlend ("Rim Light Blend", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY", Vector) = (1, 0, 0, 0)
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ _OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_emissionOptions ("Emission / Glow", Float) = 0
+ [Toggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMapUV ("Emission UV#", Int) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ _EmissionMap ("Emission Map", 2D) = "white" { }
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ _EmissionPan ("Map(XY) | Mask(ZW) Pan", Vector) = (0, 0, 0, 0)
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ _EmissiveScroll_Direction ("Emissive Scroll Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Emissive Scroll Width", Float) = 10
+ _EmissiveScroll_Velocity ("Emissive Scroll Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Emissive Scroll Interval", Float) = 20
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ [HideInInspector] m_fakeLightingOptions ("Light & Shadow", Float) = 0
+ [Toggle(_NORMALMAP)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Natural, 0, Controlled, 1, Standardish, 2, Math, 3)] _LightingType ("Lighting Type", Int) = 1
+ [Gradient]_ToonRamp ("Lighting Ramp", 2D) = "white" { }
+ _LightingShadowMask ("Shadow Mask (R)", 2D) = "white" { }
+ _ShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ _ShadowOffset ("Shadow Offset", Range(-1, 1)) = 0
+ _AOMap ("AO Map", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingAOUV ("AO Map UV#", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 1
+ [HideInInspector] m_start_lightingAdvanced ("Advanced", Float) = 0
+ _IndirectContribution ("Indirect Contribution", Range(0, 1)) = 0
+ _AdditiveSoftness ("Additive Softness", Range(0, 0.5)) = 0.005
+ _AdditiveOffset ("Additive Offset", Range(-0.5, 0.5)) = 0
+ _AttenuationMultiplier ("Attenuation", Range(0, 1)) = 0
+ [HideInInspector] m_end_lightingAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_specularHighlightsOptions ("Specular Highlights", Float) = 0
+ [Toggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3)] _SpecularType ("Specular Type", Int) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMixAlbedoIntoTint ("Mix Material Color Into Tint", Range(0, 1)) = 0
+ _SpecularSmoothness ("Smoothness", Range(0, 1)) = 1
+ _SpecularMap ("Specular Map", 2D) = "white" { }
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ [HideInInspector] m_start_SpecularToon ("Toon", Float) = 0
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_SpecularToon ("Toon", Float) = 0
+ [HideInInspector] m_start_Anisotropic ("Anisotropic", Float) = 0
+ [Enum(Tangent, 0, Bitangent, 1)] _SpecWhatTangent ("(Bi)Tangent?", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha", Range(0, 1)) = 1
+ //_Spec1Offset ("Spec1 Offset", Float) = 0
+ //_Spec1JitterStrength ("Spec1 Jitter Strength", Float) = 1.0
+ _Spec2Smoothness ("Spec2 Smoothness", Range(0, 1)) = 0
+ //_Spec2Offset ("Spec2 Offset", Float) = 0
+ //_Spec2JitterStrength ("Spec2 Jitter Strength", Float) = 1.0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map", 2D) = "bump" { }
+ //_ShiftTexture ("Shift Texture", 2D) = "black" { }
+ [HideInInspector] m_end_Anisotropic ("Anisotropic", Float) = 0
+
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [Toggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightIterations ("Parallax Height Iterations", Range(1, 10)) = 1
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+
+ [HideInInspector] m_subsurfaceOptions ("Subsurface Scattering", Float) = 0
+ [Toggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 1, 1, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSStrength ("Attenuation", Range(0, 1)) = 0
+ _SSSPower ("Light Spread", Range(1, 100)) = 1
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 0
+
+ [HideInInspector] m_rimLightOptions ("Rim Lighting", Float) = 0
+ [Toggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [Vector2]_RimTexPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [ToggleUI]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [Vector2]_RimWidthNoisePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+
+ [HideInInspector] m_flipBook ("Flipbook", Float) = 0
+ [Toggle(_FADING_ON)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookUV ("Flipbook UV#", Int) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [Vector2]_FlipbookTexturePan ("Texture Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_FlipbookMaskPan ("Mask Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Int) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ //[ToggleUI]_FlipbookControlsAlpha ("Flipbook Controls Alpha", Float) = 0
+ /*
+ [HideInInspector] m_start_FlipbookOffsetLoop ("Offset Animation", Float) = 0
+ [Enum(Off, 0, Loop, 1, Bounce, 2, Smooth Bounce, 3)]_FlipbookMovementType ("Movement Type", Int) = 1
+ _FlipbookStartEndOffset ("Start & End Offset", Vector) = (0,0,0,0)
+ _FlipbookMovementSpeed ("Speed", Float) = 1.0
+ [HideInInspector] m_end_FlipbookOffsetLoop ("Offset Animation", Float) = 0
+ */
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+
+ [HideInInspector] m_dissolve ("Dissolve", Float) = 0
+ [Toggle(_ALPHABLEND_ON)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolve to Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolve to Texture", 2D) = "white" { }
+ _DissolveToEmissionStrength ("Dissolve to Emission Strength", Range(0, 20)) = 0
+ [Vector2]_DissolveToPanning ("Dissolve to Panning", Vector) = (0, 0, 0, 0)
+ _DissolveNoiseTexture ("Dissolve Noise", 2D) = "white" { }
+ [ToggleUI]_DissolveInvertNoise ("Invert Noise", Float) = 0
+ _DissolveDetailNoise ("Dissolve Detail Noise", 2D) = "black" { }
+ [ToggleUI]_DissolveInvertDetailNoise ("Invert Detail Noise", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolvePan ("Noise (XY) | Detail (ZW) Pan", Vector) = (0, 0, 0, 0)
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [Toggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMapTexture ("Mask", 2D) = "white" { }
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+
+
+ [HideInInspector] m_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+
+ [HideInInspector] m_start_ParticleStencilPassOptions ("Particle Stencil", Float) = 0
+ [IntRange] _ParticleStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ParticleStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_ParticleStencilPassOptions ("Particle Stencil", Float) = 0
+
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _OutlineStencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _OutlineStencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ [HideInInspector] m_mirrorOptions ("Mirror", Float) = 0
+ [Toggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+
+ [HideInInspector] m_RandomOptions ("Random", Float) = 0
+ [Toggle(_SUNDISK_NONE)]_EnableRandom ("Enable Random", Float) = 0
+ [HideInInspector] m_start_Angle ("Angular Rendering", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_Angle ("Angular Rendering", Float) = 0
+
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 0
+ _ZBias ("ZBias", Float) = 0.0
+
+ [HideInInspector] m_debugOptions ("Debug", Float) = 0
+ [Toggle(_COLOROVERLAY_ON)]_DebugDisplayDebug ("Display Debug Info", Float) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ }
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "DisableBatching" = "True" "Queue" = "Transparent" "RenderType" = "Transparent" }
+ //Blend SrcAlpha OneMinusSrcAlpha
+ Blend [_SourceBlend] [_DestinationBlend]
+
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define FORWARD_BASE_PASS
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature _NORMALMAP
+ // Flipbook
+ #pragma shader_feature _FADING_ON
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_ADD_PASS
+ #define TRANSPARENT
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // POI_LIGHTING
+ #pragma shader_feature _NORMALMAP
+ // Flipbook
+ #pragma shader_feature _FADING_ON
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPass.cginc"
+ ENDCG
+
+ }
+ Pass
+ {
+ Name "Outline"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ ZWrite [_ZWrite]
+ Cull [_OutlineCull]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_BASE_PASS
+ #define TRANSPARENT
+ #define OUTLINE
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Lighting
+ #pragma shader_feature _NORMALMAP
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma multi_compile_instancing
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPassOutline.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ParticlePass"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_ParticleStencilRef]
+ Comp [_ParticleStencilCompareFunction]
+ Pass [_ParticleStencilPassOp]
+ Fail [_ParticleStencilFailOp]
+ ZFail [_ParticleStencilZFailOp]
+ }
+ ZWrite Off
+ Cull Back
+
+ CGPROGRAM
+
+ #pragma target 4.0
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex particleVert
+ #pragma geometry particleGeom
+ #pragma fragment particleFrag
+ #include "../Includes/PoiParticlePass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define POISHADOW
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/PoiPassShadow.cginc"
+ ENDCG
+
+ }
+ }
+Fallback "Toon/Lit Cutout (Double)"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonTransparent.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonTransparent.shader.meta
new file mode 100644
index 00000000..f7f8a6b2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/OutlinesPoiyomiToonTransparent.shader.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 743eed0e6bd7ebb4b95435c9609dd42f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonCutout.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonCutout.shader
new file mode 100644
index 00000000..0f83706b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonCutout.shader
@@ -0,0 +1,596 @@
+Shader ".poiyomi/Patreon/Particle2/Cutout"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#ff0000ff>❤</color> <color=#000000ff>Poiyomi Toon Shader V4.2</color> <color=#ff0000ff>❤</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+
+ _Saturation ("Saturation", Range(-1, 1)) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ _MainTex ("Texture", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("Tex UV#", Int) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [Vector2]_MainNormalPan ("Normal Pan", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Mask", 2D) = "white" { }
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.5
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 1
+ [Vector2]_GlobalPanSpeed ("Global Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_DetailOptions ("Details", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailTexUV ("Detail Tex UV#", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Vector2]_DetailTexturePan ("Detail Tex Pan", Vector) = (0, 0, 0, 0)
+ _DetailTint ("Detail Tint", Color) = (1, 1, 1)
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailNormalUV ("Detail Normal UV#", Int) = 0
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [Vector2]_MainDetailNormalPan ("Detail Normal Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+ [HideInInspector] m_start_Fade ("Fade", Float) = 0
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainFadeTexture ("Fade Map", 2D) = "white" { }
+ [Vector2]_MainDistanceFade ("Distance Fade X to Y", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_Fade ("Fade", Float) = 0
+
+ // Particles Start
+ [HideInInspector] m_particleOptions ("Particles", Float) = 0
+ [ToggleUI]_ParticleLit("Basic Lighting", Float) = 0
+ [HDR]_ParticleColor ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _ParticleTexture ("Texture", 2D) = "white" { }
+ [ToggleUI]_ParticleRandomRotation("Random Rotation", Float) = 0
+ _ParticleRotation("Rotation", Range(0, 360)) = 0
+ _ParticlePerCMSquared ("Particle/cm^2", Float) = 1
+ _ParticleAlphaCutoff ("Alpha Cutoff", Range(0,1.001)) = 0
+ _ParticleMinRenderDistance ("Min Render Distance",Float) = .2
+ [Gradient]_ParticleStartColorGradient ("Color Range", 2D) = "white" { }
+ [ToggleUI]_ColorOverLifetime("Color Over Lifetime?", Float) = 0
+ _ParticleMask ("Particle Mask", 2D) = "white" { }
+ [Enum(Spherical, 0, Linear, 1)] _ParticleMovementMode("Movement Mode", Int) = 0
+
+ [HideInInspector] m_start_sphericalMotion ("Spherical Motion", Float) = 0
+ _ColorOverLifeSpeed ("Color/Life Speed", Float) = 1
+ _ParticleScaleMin ("Scale min", float) = 0.01
+ _ParticleScaleMax ("Scale max", float) = 0.02
+ _ParticleSphericalMinSpeed("Min Speed", Float) = -5
+ _ParticleSphericalMaxSpeed("Max Speed", Float) = 5
+ _ParticleSphericalMinRadius("Min Radius", Float) = 0
+ _ParticleSphericalMaxRadius("Max Radius", Float) = 0.2
+ [HideInInspector] m_end_sphericalMotion ("Spherical Movement", Float) = 0
+
+ [HideInInspector] m_start_LinearMotion ("Linear Movement", Float) = 0
+ _ParticleLinearEndOffsetMin("End Offset Min", Vector) = (0.05,0.05,0.05,0)
+ _ParticleLinearEndOffsetMax("End Offset Max", Vector) = (-0.05,-0.05,-0.05,0)
+ [ToggleUI]_ParticleFlipParticlesGoingInward("Flip Particles Going Inward", Float) = 0
+ _ParticleLinearSpeedMin ("Min Speed", Float) = 0.1
+ _ParticleLinearSpeedMax ("Max Speed", Float) = 10
+ _ParticleLinearStartAlpha ("Start Alpha", Float) = 1
+ _ParticleLinearEndAlpha ("End Alpha", Float) = 1
+ _ParticleLinearStartSizeMin ("Start min Size", Float) = .02
+ _ParticleLinearStartSizeMax ("Start max Size", Float) = .02
+ _ParticleLinearEndSizeMin ("End min Size", Float) = 0
+ _ParticleLinearEndsizeMax ("End max Size", Float) = 0
+ _ParticleLinearNormalRange ("Normal Spawn Range", Range(-1,1)) = -1
+ [HideInInspector] m_end_LinearMotion ("Linear Motion", Float) = 0
+
+ [HideInInspector] m_start_ParticleFlipbook("Flipbook", Float) = 0
+ [ToggleUI]_EnableParticleFlipbook("Enable Flipbook", Float) = 0
+ _ParticleFlipbookTexArray ("Texture Array", 2DArray) = "" {}
+ _ParticleFlipbookTotalFrames ("Total Frames", Int) = 1
+ _ParticleFlipbookFPS ("FPS", Float) = 30.0
+ [ToggleUI]_ParticleRandomTimeOffset("Random Starting Frame?", Float) = 0
+ [HideInInspector] m_start_manualParticleFlipbookControl ("Manual Control", Float) = 0
+ _ParticleFlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualParticleFlipbookControl ("Manual Control", Float) = 0
+ [HideInInspector] m_end_ParticleFlipbook ("Flipbook", Float) = 0
+ // Particles End
+
+ [HideInInspector] m_metallicOptions ("Metallic", Float) = 0
+ [Toggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [Toggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ _ClearCoatCubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearCoatSampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearCoatMask ("Mask", 2D) = "white" { }
+ _ClearCoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearCoatSmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [ToggleUI]_ClearCoatInvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ [HideInInspector] m_matcapOptions ("Matcap / Sphere Textures", Float) = 0
+ [Toggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask", 2D) = "white" { }
+ _MatcapEmissionStrength ("Emission Strength", Range(0,20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ToggleUI]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask", 2D) = "white" { }
+ _Matcap2EmissionStrength ("Emission Strength", Range(0,20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ [HideInInspector] m_emissionOptions ("Emission / Glow", Float) = 0
+ [Toggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMapUV ("Emission UV#", Int) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ _EmissionMap ("Emission Map", 2D) = "white" { }
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ _EmissionPan ("Map(XY) | Mask(ZW) Pan", Vector) = (0, 0, 0, 0)
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ _EmissiveScroll_Direction ("Emissive Scroll Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Emissive Scroll Width", Float) = 10
+ _EmissiveScroll_Velocity ("Emissive Scroll Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Emissive Scroll Interval", Float) = 20
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ [HideInInspector] m_fakeLightingOptions ("Light & Shadow", Float) = 0
+ [Toggle(_NORMALMAP)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Natural, 0, Controlled, 1, Standardish, 2, Math, 3)] _LightingType ("Lighting Type", Int) = 1
+ [Gradient]_ToonRamp ("Lighting Ramp", 2D) = "white" { }
+ _LightingShadowMask ("Shadow Mask (R)", 2D) = "white" { }
+ _ShadowStrength ("Shadow Strength", Range(0, 1)) = .2
+ _ShadowOffset ("Shadow Offset", Range(-1, 1)) = 0
+ _AOMap ("AO Map", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingAOUV ("AO Map UV#", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 1
+ [HideInInspector] m_start_lightingAdvanced ("Advanced", Float) = 0
+ _IndirectContribution ("Indirect Contribution", Range(0, 1)) = 0
+ _AdditiveSoftness ("Additive Softness", Range(0, 0.5)) = 0.005
+ _AdditiveOffset ("Additive Offset", Range(-0.5, 0.5)) = 0
+ _AttenuationMultiplier ("Attenuation", Range(0, 1)) = 0
+ [HideInInspector] m_end_lightingAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_specularHighlightsOptions ("Specular Highlights", Float) = 0
+ [Toggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3)] _SpecularType ("Specular Type", Int) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMixAlbedoIntoTint ("Mix Material Color Into Tint", Range(0, 1)) = 0
+ _SpecularSmoothness ("Smoothness", Range(0, 1)) = 1
+ _SpecularMap ("Specular Map", 2D) = "white" { }
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ [HideInInspector] m_start_SpecularToon ("Toon", Float) = 0
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_SpecularToon ("Toon", Float) = 0
+ [HideInInspector] m_start_Anisotropic ("Anisotropic", Float) = 0
+ [Enum(Tangent, 0, Bitangent, 1)] _SpecWhatTangent ("(Bi)Tangent?", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha", Range(0, 1)) = 1
+ //_Spec1Offset ("Spec1 Offset", Float) = 0
+ //_Spec1JitterStrength ("Spec1 Jitter Strength", Float) = 1.0
+ _Spec2Smoothness ("Spec2 Smoothness", Range(0, 1)) = 0
+ //_Spec2Offset ("Spec2 Offset", Float) = 0
+ //_Spec2JitterStrength ("Spec2 Jitter Strength", Float) = 1.0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map", 2D) = "bump" { }
+ //_ShiftTexture ("Shift Texture", 2D) = "black" { }
+ [HideInInspector] m_end_Anisotropic ("Anisotropic", Float) = 0
+
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [Toggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightIterations ("Parallax Height Iterations", Range(1, 10)) = 1
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+
+ [HideInInspector] m_subsurfaceOptions ("Subsurface Scattering", Float) = 0
+ [Toggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 1, 1, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSStrength ("Attenuation", Range(0, 1)) = 0
+ _SSSPower ("Light Spread", Range(1, 100)) = 1
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 0
+
+ [HideInInspector] m_rimLightOptions ("Rim Lighting", Float) = 0
+ [Toggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [Vector2]_RimTexPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [ToggleUI]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [Vector2]_RimWidthNoisePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+
+ [HideInInspector] m_flipBook ("Flipbook", Float) = 0
+ [Toggle(_FADING_ON)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookUV ("Flipbook UV#", Int) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [Vector2]_FlipbookTexturePan ("Texture Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_FlipbookMaskPan ("Mask Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Int) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ //[ToggleUI]_FlipbookControlsAlpha ("Flipbook Controls Alpha", Float) = 0
+
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+
+ [HideInInspector] m_dissolve ("Dissolve", Float) = 0
+ [Toggle(_ALPHABLEND_ON)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolve to Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolve to Texture", 2D) = "white" { }
+ _DissolveToEmissionStrength ("Dissolve to Emission Strength", Range(0, 20)) = 0
+ [Vector2]_DissolveToPanning ("Dissolve to Panning", Vector) = (0, 0, 0, 0)
+ _DissolveNoiseTexture ("Dissolve Noise", 2D) = "white" { }
+ [ToggleUI]_DissolveInvertNoise ("Invert Noise", Float) = 0
+ _DissolveDetailNoise ("Dissolve Detail Noise", 2D) = "black" { }
+ [ToggleUI]_DissolveInvertDetailNoise ("Invert Detail Noise", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolvePan ("Noise (XY) | Detail (ZW) Pan", Vector) = (0, 0, 0, 0)
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [Toggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMapTexture ("Mask", 2D) = "white" { }
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+
+ [HideInInspector] m_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+
+ [HideInInspector] m_start_ParticleStencilPassOptions ("Particle Stencil", Float) = 0
+ [IntRange] _ParticleStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ParticleStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_ParticleStencilPassOptions ("Particle Stencil", Float) = 0
+
+ [HideInInspector] m_mirrorOptions ("Mirror", Float) = 0
+ [Toggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+
+ [HideInInspector] m_RandomOptions ("Random", Float) = 0
+ [Toggle(_SUNDISK_NONE)]_EnableRandom ("Enable Random", Float) = 0
+ [HideInInspector] m_start_Angle ("Angular Rendering", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_Angle ("Angular Rendering", Float) = 0
+
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ _ZBias ("ZBias", Float) = 0.0
+
+ [HideInInspector] m_debugOptions ("Debug", Float) = 0
+ [Toggle(_COLOROVERLAY_ON)]_DebugDisplayDebug ("Display Debug Info", Float) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ }
+
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "DisableBatching" = "True" "RenderType" = "TransparentCutout" "Queue" = "AlphaTest" }
+
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask On
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_BASE_PASS
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature _NORMALMAP
+ // Flipbook
+ #pragma shader_feature _FADING_ON
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ AlphaToMask On
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_ADD_PASS
+ #define BINORMAL_PER_FRAGMENT
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature _NORMALMAP
+ // Flipbook
+ #pragma shader_feature _FADING_ON
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ParticlePass"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_ParticleStencilRef]
+ Comp [_ParticleStencilCompareFunction]
+ Pass [_ParticleStencilPassOp]
+ Fail [_ParticleStencilFailOp]
+ ZFail [_ParticleStencilZFailOp]
+ }
+ ZWrite On
+ Cull Back
+ AlphaToMask On
+
+ CGPROGRAM
+ #pragma target 4.0
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex particleVert
+ #pragma geometry particleGeom
+ #pragma fragment particleFrag
+ #include "../Includes/PoiParticlePass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define CUTOUT
+ #define POISHADOW
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/PoiPassShadow.cginc"
+ ENDCG
+
+ }
+ }
+Fallback "Toon/Lit Cutout (Double)"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonCutout.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonCutout.shader.meta
new file mode 100644
index 00000000..ff7f3557
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonCutout.shader.meta
@@ -0,0 +1,27 @@
+fileFormatVersion: 2
+guid: 19c3926362228c541bbece0b9045e4c5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {instanceID: 0}
+ - _BumpMap: {instanceID: 0}
+ - _AlphaMask: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _DetailNormalMask: {instanceID: 0}
+ - _CubeMap: {fileID: 8900000, guid: a0fde614a95c2d44ca3dec1fba756a6f, type: 3}
+ - _MetallicMap: {instanceID: 0}
+ - _SmoothnessMap: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMap: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _ToonRamp: {fileID: 2800000, guid: 7744a2dff3641604fa8b6601a055824c, type: 3}
+ - _AOMap: {instanceID: 0}
+ - _SpecularMap: {instanceID: 0}
+ - _SpecularHighTexture: {instanceID: 0}
+ - _SSSThicknessMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ - _RimMask: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonTransparent.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonTransparent.shader
new file mode 100644
index 00000000..810438ca
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonTransparent.shader
@@ -0,0 +1,601 @@
+Shader ".poiyomi/Patreon/Particle2/Transparent"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#ff0000ff>❤</color> <color=#000000ff>Poiyomi Toon Shader V4.2</color> <color=#ff0000ff>❤</color>", Float) = 0
+ [HideInInspector] shader_properties_label_file ("7PlusLabels", Float) = 0
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _Saturation ("Saturation", Range(-1, 1)) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ _MainTex ("Texture", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("Tex UV#", Int) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [Vector2]_MainNormalPan ("Normal Pan", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Mask", 2D) = "white" { }
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.5
+ [Vector2]_GlobalPanSpeed ("Global Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_DetailOptions ("Details", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailTexUV ("Detail Tex UV#", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Vector2]_DetailTexturePan ("Detail Tex Pan", Vector) = (0, 0, 0, 0)
+ _DetailTint ("Detail Tint", Color) = (1, 1, 1)
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailNormalUV ("Detail Normal UV#", Int) = 0
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [Vector2]_MainDetailNormalPan ("Detail Normal Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+ [HideInInspector] m_start_Fade ("Fade", Float) = 0
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainFadeTexture ("Fade Map", 2D) = "white" { }
+ [Vector2]_MainDistanceFade ("Distance Fade X to Y", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_Fade ("Fade", Float) = 0
+
+ // Particles Start
+ [HideInInspector] m_particleOptions ("Particles", Float) = 0
+ [ToggleUI]_ParticleLit ("Basic Lighting", Float) = 0
+ [HDR]_ParticleColor ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _ParticleTexture ("Texture", 2D) = "white" { }
+ [ToggleUI]_ParticleRandomRotation ("Random Rotation", Float) = 0
+ _ParticleRotation ("Rotation", Range(0, 360)) = 0
+ _ParticlePerCMSquared ("Particle/cm^2", Float) = 1
+ _ParticleAlphaCutoff ("Alpha Cutoff", Range(0, 1.001)) = 0
+ _ParticleMinRenderDistance ("Min Render Distance", Float) = .2
+ [Gradient]_ParticleStartColorGradient ("Color Range", 2D) = "white" { }
+ [ToggleUI]_ColorOverLifetime ("Color Over Lifetime?", Float) = 0
+ _ParticleMask ("Particle Mask", 2D) = "white" { }
+ [Enum(Spherical, 0, Linear, 1)] _ParticleMovementMode ("Movement Mode", Int) = 0
+
+ [HideInInspector] m_start_sphericalMotion ("Spherical Motion", Float) = 0
+ _ColorOverLifeSpeed ("Color/Life Speed", Float) = 1
+ _ParticleScaleMin ("Scale min", float) = 0.01
+ _ParticleScaleMax ("Scale max", float) = 0.02
+ _ParticleSphericalMinSpeed ("Min Speed", Float) = -5
+ _ParticleSphericalMaxSpeed ("Max Speed", Float) = 5
+ _ParticleSphericalMinRadius ("Min Radius", Float) = 0
+ _ParticleSphericalMaxRadius ("Max Radius", Float) = 0.2
+ [HideInInspector] m_end_sphericalMotion ("Spherical Movement", Float) = 0
+
+ [HideInInspector] m_start_LinearMotion ("Linear Movement", Float) = 0
+ _ParticleLinearEndOffsetMin ("End Offset Min", Vector) = (0.05, 0.05, 0.05, 0)
+ _ParticleLinearEndOffsetMax ("End Offset Max", Vector) = (-0.05, -0.05, -0.05, 0)
+ [ToggleUI]_ParticleFlipParticlesGoingInward ("Flip Particles Going Inward", Float) = 0
+ _ParticleLinearSpeedMin ("Min Speed", Float) = 0.1
+ _ParticleLinearSpeedMax ("Max Speed", Float) = 10
+ _ParticleLinearStartAlpha ("Start Alpha", Float) = 1
+ _ParticleLinearEndAlpha ("End Alpha", Float) = 1
+ _ParticleLinearStartSizeMin ("Start min Size", Float) = .02
+ _ParticleLinearStartSizeMax ("Start max Size", Float) = .02
+ _ParticleLinearEndSizeMin ("End min Size", Float) = 0
+ _ParticleLinearEndsizeMax ("End max Size", Float) = 0
+ _ParticleLinearNormalRange ("Normal Spawn Range", Range(-1, 1)) = -1
+ [HideInInspector] m_end_LinearMotion ("Linear Motion", Float) = 0
+
+ [HideInInspector] m_start_ParticleFlipbook("Flipbook", Float) = 0
+ [ToggleUI]_EnableParticleFlipbook("Enable Flipbook", Float) = 0
+ _ParticleFlipbookTexArray ("Texture Array", 2DArray) = "" {}
+ _ParticleFlipbookTotalFrames ("Total Frames", Int) = 1
+ _ParticleFlipbookFPS ("FPS", Float) = 30.0
+ [ToggleUI]_ParticleRandomTimeOffset("Random Starting Frame?", Float) = 0
+ [HideInInspector] m_start_manualParticleFlipbookControl ("Manual Control", Float) = 0
+ _ParticleFlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualParticleFlipbookControl ("Manual Control", Float) = 0
+ [HideInInspector] m_end_ParticleFlipbook ("Flipbook", Float) = 0
+ // Particles End
+
+ [HideInInspector] m_metallicOptions ("Metallic", Float) = 0
+ [Toggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [Toggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ _ClearCoatCubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearCoatSampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearCoatMask ("Mask", 2D) = "white" { }
+ _ClearCoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearCoatSmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [ToggleUI]_ClearCoatInvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ [HideInInspector] m_matcapOptions ("Matcap / Sphere Textures", Float) = 0
+ [Toggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask", 2D) = "white" { }
+ _MatcapEmissionStrength ("Emission Strength", Range(0,20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ToggleUI]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask", 2D) = "white" { }
+ _Matcap2EmissionStrength ("Emission Strength", Range(0,20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ [HideInInspector] m_emissionOptions ("Emission / Glow", Float) = 0
+ [Toggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMapUV ("Emission UV#", Int) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ _EmissionMap ("Emission Map", 2D) = "white" { }
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ _EmissionPan ("Map(XY) | Mask(ZW) Pan", Vector) = (0, 0, 0, 0)
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ _EmissiveScroll_Direction ("Emissive Scroll Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Emissive Scroll Width", Float) = 10
+ _EmissiveScroll_Velocity ("Emissive Scroll Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Emissive Scroll Interval", Float) = 20
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ [HideInInspector] m_fakeLightingOptions ("Light & Shadow", Float) = 0
+ [Toggle(_NORMALMAP)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Natural, 0, Controlled, 1, Standardish, 2, Math, 3)] _LightingType ("Lighting Type", Int) = 1
+ [Gradient]_ToonRamp ("Lighting Ramp", 2D) = "white" { }
+ _LightingShadowMask ("Shadow Mask (R)", 2D) = "white" { }
+ _ShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ _ShadowOffset ("Shadow Offset", Range(-1, 1)) = 0
+ _AOMap ("AO Map", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingAOUV ("AO Map UV#", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 1
+ [HideInInspector] m_start_lightingAdvanced ("Advanced", Float) = 0
+ _IndirectContribution ("Indirect Contribution", Range(0, 1)) = 0
+ _AdditiveSoftness ("Additive Softness", Range(0, 0.5)) = 0.005
+ _AdditiveOffset ("Additive Offset", Range(-0.5, 0.5)) = 0
+ _AttenuationMultiplier ("Attenuation", Range(0, 1)) = 0
+ [HideInInspector] m_end_lightingAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_specularHighlightsOptions ("Specular Highlights", Float) = 0
+ [Toggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3)] _SpecularType ("Specular Type", Int) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMixAlbedoIntoTint ("Mix Material Color Into Tint", Range(0, 1)) = 0
+ _SpecularSmoothness ("Smoothness", Range(0, 1)) = 1
+ _SpecularMap ("Specular Map", 2D) = "white" { }
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ [HideInInspector] m_start_SpecularToon ("Toon", Float) = 0
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_SpecularToon ("Toon", Float) = 0
+ [HideInInspector] m_start_Anisotropic ("Anisotropic", Float) = 0
+ [Enum(Tangent, 0, Bitangent, 1)] _SpecWhatTangent ("(Bi)Tangent?", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha", Range(0, 1)) = 1
+ //_Spec1Offset ("Spec1 Offset", Float) = 0
+ //_Spec1JitterStrength ("Spec1 Jitter Strength", Float) = 1.0
+ _Spec2Smoothness ("Spec2 Smoothness", Range(0, 1)) = 0
+ //_Spec2Offset ("Spec2 Offset", Float) = 0
+ //_Spec2JitterStrength ("Spec2 Jitter Strength", Float) = 1.0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map", 2D) = "bump" { }
+ //_ShiftTexture ("Shift Texture", 2D) = "black" { }
+ [HideInInspector] m_end_Anisotropic ("Anisotropic", Float) = 0
+
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [Toggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightIterations ("Parallax Height Iterations", Range(1, 10)) = 1
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+
+ [HideInInspector] m_subsurfaceOptions ("Subsurface Scattering", Float) = 0
+ [Toggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 1, 1, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSStrength ("Attenuation", Range(0, 1)) = 0
+ _SSSPower ("Light Spread", Range(1, 100)) = 1
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 0
+
+ [HideInInspector] m_rimLightOptions ("Rim Lighting", Float) = 0
+ [Toggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [Vector2]_RimTexPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [ToggleUI]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [Vector2]_RimWidthNoisePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+
+ [HideInInspector] m_flipBook ("Flipbook", Float) = 0
+ [Toggle(_FADING_ON)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookUV ("Flipbook UV#", Int) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [Vector2]_FlipbookTexturePan ("Texture Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_FlipbookMaskPan ("Mask Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Int) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ //[ToggleUI]_FlipbookControlsAlpha ("Flipbook Controls Alpha", Float) = 0
+ /*
+ [HideInInspector] m_start_FlipbookOffsetLoop ("Offset Animation", Float) = 0w
+ [Enum(Off, 0, Loop, 1, Bounce, 2, Smooth Bounce, 3)]_FlipbookMovementType ("Movement Type", Int) = 1w
+ _FlipbookStartEndOffset ("Start & End Offset", Vector) = (0,0,0,0)
+ _FlipbookMovementSpeed ("Speed", Float) = 1.0
+ [HideInInspector] m_end_FlipbookOffsetLoop ("Offset Animation", Float) = 0
+ */
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+
+ [HideInInspector] m_dissolve ("Dissolve", Float) = 0
+ [Toggle(_ALPHABLEND_ON)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolve to Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolve to Texture", 2D) = "white" { }
+ _DissolveToEmissionStrength ("Dissolve to Emission Strength", Range(0, 20)) = 0
+ [Vector2]_DissolveToPanning ("Dissolve to Panning", Vector) = (0, 0, 0, 0)
+ _DissolveNoiseTexture ("Dissolve Noise", 2D) = "white" { }
+ [ToggleUI]_DissolveInvertNoise ("Invert Noise", Float) = 0
+ _DissolveDetailNoise ("Dissolve Detail Noise", 2D) = "black" { }
+ [ToggleUI]_DissolveInvertDetailNoise ("Invert Detail Noise", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolvePan ("Noise (XY) | Detail (ZW) Pan", Vector) = (0, 0, 0, 0)
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [Toggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMapTexture ("Mask", 2D) = "white" { }
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+
+ [HideInInspector] m_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+
+ [HideInInspector] m_start_ParticleStencilPassOptions ("Particle Stencil", Float) = 0
+ [IntRange] _ParticleStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _ParticleStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ParticleStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_ParticleStencilPassOptions ("Particle Stencil", Float) = 0
+
+ [HideInInspector] m_mirrorOptions ("Mirror", Float) = 0
+ [Toggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+
+ [HideInInspector] m_RandomOptions ("Random", Float) = 0
+ [Toggle(_SUNDISK_NONE)]_EnableRandom ("Enable Random", Float) = 0
+ [HideInInspector] m_start_Angle ("Angular Rendering", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_Angle ("Angular Rendering", Float) = 0
+
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 0
+ _ZBias ("ZBias", Float) = 0.0
+
+ [HideInInspector] m_debugOptions ("Debug", Float) = 0
+ [Toggle(_COLOROVERLAY_ON)]_DebugDisplayDebug ("Display Debug Info", Float) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ }
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "DisableBatching" = "True" "Queue" = "Transparent" "RenderType" = "Transparent" }
+ //Blend SrcAlpha OneMinusSrcAlpha
+ Blend [_SourceBlend] [_DestinationBlend]
+
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define FORWARD_BASE_PASS
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature _NORMALMAP
+ // Flipbook
+ #pragma shader_feature _FADING_ON
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define FORWARD_ADD_PASS
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature _NORMALMAP
+ // Flipbook
+ #pragma shader_feature _FADING_ON
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ParticlePass"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_ParticleStencilRef]
+ Comp [_ParticleStencilCompareFunction]
+ Pass [_ParticleStencilPassOp]
+ Fail [_ParticleStencilFailOp]
+ ZFail [_ParticleStencilZFailOp]
+ }
+ ZWrite Off
+ Cull Back
+
+ CGPROGRAM
+
+ #pragma target 4.0
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex particleVert
+ #pragma geometry particleGeom
+ #pragma fragment particleFrag
+ #include "../Includes/PoiParticlePass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define POISHADOW
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature _ALPHABLEND_ON
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/PoiPassShadow.cginc"
+ ENDCG
+
+ }
+ }
+Fallback "Toon/Lit Cutout (Double)"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonTransparent.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonTransparent.shader.meta
new file mode 100644
index 00000000..fd6981ab
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/LocalParticles/Shaders/Toon/PoiyomiToonTransparent.shader.meta
@@ -0,0 +1,27 @@
+fileFormatVersion: 2
+guid: 3b42194eebbc4f849956916f885871ad
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {instanceID: 0}
+ - _BumpMap: {instanceID: 0}
+ - _AlphaMask: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _DetailNormalMask: {instanceID: 0}
+ - _CubeMap: {fileID: 8900000, guid: a0fde614a95c2d44ca3dec1fba756a6f, type: 3}
+ - _MetallicMap: {instanceID: 0}
+ - _SmoothnessMap: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMap: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _ToonRamp: {fileID: 2800000, guid: 7744a2dff3641604fa8b6601a055824c, type: 3}
+ - _AOMap: {instanceID: 0}
+ - _SpecularMap: {instanceID: 0}
+ - _SpecularHighTexture: {instanceID: 0}
+ - _SSSThicknessMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ - _RimMask: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag.meta
new file mode 100644
index 00000000..ce10274f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 18b2a630ebb4a7543874fa747508575d
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 1.mat b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 1.mat
new file mode 100644
index 00000000..27525b78
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 1.mat
@@ -0,0 +1,245 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: NameTagMaterial 1
+ m_Shader: {fileID: 4800000, guid: 3640220fcd5a3664b9e7135a1c1a1ed4, type: 3}
+ m_ShaderKeywords:
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap: {}
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _AdditiveRamp:
+ m_Texture: {fileID: 2800000, guid: 2b2456e68290a8847a6903bc0005d58f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _CubeMap:
+ m_Texture: {fileID: 8900000, guid: a0fde614a95c2d44ca3dec1fba756a6f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Matcap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MatcapMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Name:
+ m_Texture: {fileID: 2800000, guid: d4d4b2bd815839649b7a89219c93d214, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NameTexture:
+ m_Texture: {fileID: 2800000, guid: 129da761178f60b42b1bc6a528fed6c9, type: 3}
+ m_Scale: {x: 2, y: 2}
+ m_Offset: {x: 0, y: 0.5}
+ - _NoiseTexture:
+ m_Texture: {fileID: 2800000, guid: 0a224b646156f5e43bd5fcaaed9bfe1e, type: 3}
+ m_Scale: {x: 5, y: 5}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Ramp:
+ m_Texture: {fileID: 2800000, guid: 2b2456e68290a8847a6903bc0005d58f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RimTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RoughnessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecularMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _UnderWaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _WaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _AddMatcap: 0
+ - _AdditiveClearCoat: 0
+ - _BackgroundEmissionStrength: 1
+ - _BackgroundGradientMax: 0.08
+ - _BackgroundGradientMin: 0.008
+ - _BumpScale: 1
+ - _Clip: 0.5
+ - _Cull: 2
+ - _Cutoff: 0.5
+ - _Desaturation: 0
+ - _DestinationBlend: 10
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _Emission: 0.5
+ - _EmissionStrength: 1.5
+ - _EmissiveBlink_Max: 1
+ - _EmissiveBlink_Min: 1
+ - _EmissiveBlink_Velocity: 4
+ - _EmissiveScroll_Interval: 20
+ - _EmissiveScroll_Velocity: 10
+ - _EmissiveScroll_Width: 10
+ - _FlatOrFullAmbientLighting: 0
+ - _ForceLightDirection: 0
+ - _ForceShadowStrength: 0
+ - _ForegroundEmissionStrength: 1
+ - _ForegroundGradientMax: 0.059
+ - _ForegroundGradientMin: 0
+ - _Gloss: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0.5
+ - _GlossyReflections: 1
+ - _GradMin: 0.47
+ - _HardSpecular: 0
+ - _HeightThreshold: 0.98
+ - _MatcapStrength: 1
+ - _MaxBrightness: 100
+ - _Metallic: 0
+ - _MinBrightness: 0
+ - _Mode: 0
+ - _MultiplyMatcap: 0
+ - _NameEmissionStrength: 1
+ - _OcclusionStrength: 1
+ - _Opacity: 0.5
+ - _OutlineStencilCompareFunction: 8
+ - _OutlineStencilFailOp: 0
+ - _OutlineStencilPassOp: 0
+ - _OutlineStencilReadMaskRef: 0
+ - _OutlineStencilRef: 0
+ - _OutlineStencilWriteMaskRef: 0
+ - _OutlineStencilZFailOp: 0
+ - _Parallax: 0.02
+ - _PurelyAdditive: 0
+ - _ReplaceWithMatcap: 0
+ - _RimLightColorBias: 0
+ - _RimSharpness: 0.25
+ - _RimStrength: 0
+ - _RimWidth: 0.8
+ - _Roughness: 0
+ - _SampleWorld: 0
+ - _ScrollingEmission: 0
+ - _ShadowOffset: 0
+ - _ShadowStrength: 1
+ - _SmoothnessTextureChannel: 0
+ - _SourceBlend: 5
+ - _SpecularBias: 0
+ - _SpecularHighlights: 1
+ - _SpecularSize: 0.005
+ - _SpecularStrength: 0
+ - _SrcBlend: 1
+ - _StencilCompareFunction: 8
+ - _StencilFailOp: 0
+ - _StencilPassOp: 0
+ - _StencilReadMaskRef: 0
+ - _StencilRef: 0
+ - _StencilWriteMaskRef: 0
+ - _StencilZFailOp: 0
+ - _UVSec: 0
+ - _UnderWaveEmission: 2
+ - _WaveEmission: 2
+ - _WaveHeight: 0.01
+ - _ZTest: 4
+ - _ZWrite: 1
+ - footer_discord: 0
+ - footer_donate: 0
+ - footer_github: 0
+ - footer_patreon: 0
+ - m_StencilPassOptions: 0
+ - m_emissionOptions: 0
+ - m_end_OutlineStencil: 0
+ - m_end_blinkingEmissionOptions: 0
+ - m_end_mainAdvanced: 0
+ - m_end_scrollingEmissionOptions: 0
+ - m_fakeLightingOptions: 0
+ - m_mainOptions: 0
+ - m_matcapOptions: 0
+ - m_metallicOptions: 0
+ - m_miscOptions: 0
+ - m_rimLightOptions: 0
+ - m_shatterWave: 0
+ - m_specularHighlightsOptions: 0
+ - m_start_OutlineStencil: 0
+ - m_start_blinkingEmissionOptions: 0
+ - m_start_mainAdvanced: 0
+ - m_start_scrollingEmissionOptions: 0
+ - shader_master_label: 0
+ - shader_presets: 0
+ m_Colors:
+ - _BackgroundColor: {r: 0, g: 0.5, b: 0.003448248, a: 1}
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+ - _EmissionScrollSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _EmissiveScroll_Direction: {r: 0, g: -10, b: 0, a: 0}
+ - _ForegroundColor: {r: 0, g: 0.7352941, b: 0.03549702, a: 1}
+ - _LightDirection: {r: 0, g: 1, b: 0, a: 0}
+ - _MatcapColor: {r: 1, g: 1, b: 1, a: 1}
+ - _NameColor: {r: 0.05258621, g: 0, b: 0.44852942, a: 1}
+ - _NamePan: {r: 0.1, g: 0, b: 0, a: 0}
+ - _NoisePan: {r: -0.01, g: 0.2, b: 0, a: 0}
+ - _RimLightColor: {r: 1, g: 1, b: 1, a: 1}
+ - _RimTexPanSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
+ - _Vector0: {r: 1, g: 0, b: 0, a: 0}
+ - _WaveColor: {r: 1, g: 1, b: 1, a: 1}
+ - _WaveDensity: {r: 10, g: 8, b: 9, a: 0}
+ - _WaveSlope: {r: 2, g: 2, b: 2, a: 0}
+ - _WaveSpeed: {r: 0.5, g: 0.6, b: 0.7, a: 0}
+ - _underWaveColor: {r: 1, g: 1, b: 1, a: 1}
+ - float4: {r: 0.1, g: 0, b: 0, a: 0}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 1.mat.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 1.mat.meta
new file mode 100644
index 00000000..aad831e3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 1.mat.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e109fd1ae7cdabe4086b4e63fdeeacb5
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 2.mat b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 2.mat
new file mode 100644
index 00000000..87d467d7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 2.mat
@@ -0,0 +1,245 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: NameTagMaterial 2
+ m_Shader: {fileID: 4800000, guid: 3640220fcd5a3664b9e7135a1c1a1ed4, type: 3}
+ m_ShaderKeywords:
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap: {}
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _AdditiveRamp:
+ m_Texture: {fileID: 2800000, guid: 2b2456e68290a8847a6903bc0005d58f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _CubeMap:
+ m_Texture: {fileID: 8900000, guid: a0fde614a95c2d44ca3dec1fba756a6f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Matcap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MatcapMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Name:
+ m_Texture: {fileID: 2800000, guid: d4d4b2bd815839649b7a89219c93d214, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NameTexture:
+ m_Texture: {fileID: 2800000, guid: 0ed883f8f92c31f4d87de788be1e5ab2, type: 3}
+ m_Scale: {x: 2, y: 2}
+ m_Offset: {x: 0, y: 0.48}
+ - _NoiseTexture:
+ m_Texture: {fileID: 2800000, guid: 3359c478f7216f441a8f8e209d0fb696, type: 3}
+ m_Scale: {x: 10, y: 10}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Ramp:
+ m_Texture: {fileID: 2800000, guid: 2b2456e68290a8847a6903bc0005d58f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RimTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RoughnessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecularMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _UnderWaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _WaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _AddMatcap: 0
+ - _AdditiveClearCoat: 0
+ - _BackgroundEmissionStrength: 1
+ - _BackgroundGradientMax: 0.043
+ - _BackgroundGradientMin: 0
+ - _BumpScale: 1
+ - _Clip: 0.5
+ - _Cull: 2
+ - _Cutoff: 0.5
+ - _Desaturation: 0
+ - _DestinationBlend: 10
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _Emission: 0.5
+ - _EmissionStrength: 2.57
+ - _EmissiveBlink_Max: 1
+ - _EmissiveBlink_Min: 1
+ - _EmissiveBlink_Velocity: 4
+ - _EmissiveScroll_Interval: 20
+ - _EmissiveScroll_Velocity: 10
+ - _EmissiveScroll_Width: 10
+ - _FlatOrFullAmbientLighting: 0
+ - _ForceLightDirection: 0
+ - _ForceShadowStrength: 0
+ - _ForegroundEmissionStrength: 1
+ - _ForegroundGradientMax: 0.03
+ - _ForegroundGradientMin: 0.01
+ - _Gloss: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0.5
+ - _GlossyReflections: 1
+ - _GradMin: 0.47
+ - _HardSpecular: 0
+ - _HeightThreshold: 0.98
+ - _MatcapStrength: 1
+ - _MaxBrightness: 100
+ - _Metallic: 0
+ - _MinBrightness: 0
+ - _Mode: 0
+ - _MultiplyMatcap: 0
+ - _NameEmissionStrength: 1
+ - _OcclusionStrength: 1
+ - _Opacity: 0.5
+ - _OutlineStencilCompareFunction: 8
+ - _OutlineStencilFailOp: 0
+ - _OutlineStencilPassOp: 0
+ - _OutlineStencilReadMaskRef: 0
+ - _OutlineStencilRef: 0
+ - _OutlineStencilWriteMaskRef: 0
+ - _OutlineStencilZFailOp: 0
+ - _Parallax: 0.02
+ - _PurelyAdditive: 0
+ - _ReplaceWithMatcap: 0
+ - _RimLightColorBias: 0
+ - _RimSharpness: 0.25
+ - _RimStrength: 0
+ - _RimWidth: 0.8
+ - _Roughness: 0
+ - _SampleWorld: 0
+ - _ScrollingEmission: 0
+ - _ShadowOffset: 0
+ - _ShadowStrength: 1
+ - _SmoothnessTextureChannel: 0
+ - _SourceBlend: 5
+ - _SpecularBias: 0
+ - _SpecularHighlights: 1
+ - _SpecularSize: 0.005
+ - _SpecularStrength: 0
+ - _SrcBlend: 1
+ - _StencilCompareFunction: 8
+ - _StencilFailOp: 0
+ - _StencilPassOp: 0
+ - _StencilReadMaskRef: 0
+ - _StencilRef: 0
+ - _StencilWriteMaskRef: 0
+ - _StencilZFailOp: 0
+ - _UVSec: 0
+ - _UnderWaveEmission: 2
+ - _WaveEmission: 2
+ - _WaveHeight: 0.01
+ - _ZTest: 4
+ - _ZWrite: 1
+ - footer_discord: 0
+ - footer_donate: 0
+ - footer_github: 0
+ - footer_patreon: 0
+ - m_StencilPassOptions: 0
+ - m_emissionOptions: 0
+ - m_end_OutlineStencil: 0
+ - m_end_blinkingEmissionOptions: 0
+ - m_end_mainAdvanced: 0
+ - m_end_scrollingEmissionOptions: 0
+ - m_fakeLightingOptions: 0
+ - m_mainOptions: 0
+ - m_matcapOptions: 0
+ - m_metallicOptions: 0
+ - m_miscOptions: 0
+ - m_rimLightOptions: 0
+ - m_shatterWave: 0
+ - m_specularHighlightsOptions: 0
+ - m_start_OutlineStencil: 0
+ - m_start_blinkingEmissionOptions: 0
+ - m_start_mainAdvanced: 0
+ - m_start_scrollingEmissionOptions: 0
+ - shader_master_label: 0
+ - shader_presets: 0
+ m_Colors:
+ - _BackgroundColor: {r: 1, g: 0.709, b: 1, a: 1}
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+ - _EmissionScrollSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _EmissiveScroll_Direction: {r: 0, g: -10, b: 0, a: 0}
+ - _ForegroundColor: {r: 0.6965518, g: 0, b: 1, a: 1}
+ - _LightDirection: {r: 0, g: 1, b: 0, a: 0}
+ - _MatcapColor: {r: 1, g: 1, b: 1, a: 1}
+ - _NameColor: {r: 1, g: 1, b: 1, a: 1}
+ - _NamePan: {r: 0.1, g: 0, b: 0, a: 0}
+ - _NoisePan: {r: -0.01, g: 0.2, b: 0, a: 0}
+ - _RimLightColor: {r: 1, g: 1, b: 1, a: 1}
+ - _RimTexPanSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
+ - _Vector0: {r: 1, g: 0, b: 0, a: 0}
+ - _WaveColor: {r: 1, g: 1, b: 1, a: 1}
+ - _WaveDensity: {r: 10, g: 8, b: 9, a: 0}
+ - _WaveSlope: {r: 2, g: 2, b: 2, a: 0}
+ - _WaveSpeed: {r: 0.5, g: 0.6, b: 0.7, a: 0}
+ - _underWaveColor: {r: 1, g: 1, b: 1, a: 1}
+ - float4: {r: 0.1, g: 0, b: 0, a: 0}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 2.mat.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 2.mat.meta
new file mode 100644
index 00000000..68eb230c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial 2.mat.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 0620354c842555445a491b682a5576bf
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial.mat b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial.mat
new file mode 100644
index 00000000..5ef03fa7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial.mat
@@ -0,0 +1,247 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_Name: NameTagMaterial
+ m_Shader: {fileID: 4800000, guid: 3640220fcd5a3664b9e7135a1c1a1ed4, type: 3}
+ m_ShaderKeywords:
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap: {}
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _AdditiveRamp:
+ m_Texture: {fileID: 2800000, guid: 2b2456e68290a8847a6903bc0005d58f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _CubeMap:
+ m_Texture: {fileID: 8900000, guid: a0fde614a95c2d44ca3dec1fba756a6f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Matcap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MatcapMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Name:
+ m_Texture: {fileID: 2800000, guid: d4d4b2bd815839649b7a89219c93d214, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NameTexture:
+ m_Texture: {fileID: 2800000, guid: 0ed883f8f92c31f4d87de788be1e5ab2, type: 3}
+ m_Scale: {x: 2, y: 2}
+ m_Offset: {x: 0, y: 0.48}
+ - _NoiseTexture:
+ m_Texture: {fileID: 2800000, guid: f09ed133d3c2ea743880f31ed4c4ec60, type: 3}
+ m_Scale: {x: 10, y: 10}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Ramp:
+ m_Texture: {fileID: 2800000, guid: 2b2456e68290a8847a6903bc0005d58f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RimTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RoughnessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecularMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _UnderWaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _WaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _AddMatcap: 0
+ - _AdditiveClearCoat: 0
+ - _BackgroundEmissionStrength: 1
+ - _BackgroundGradientMax: 0.068
+ - _BackgroundGradientMin: 0
+ - _BumpScale: 1
+ - _Clip: 0.5
+ - _Cull: 2
+ - _Cutoff: 0.5
+ - _Desaturation: 0
+ - _DestinationBlend: 10
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _Emission: 0.5
+ - _EmissionStrength: 1.75
+ - _EmissiveBlink_Max: 1
+ - _EmissiveBlink_Min: 1
+ - _EmissiveBlink_Velocity: 4
+ - _EmissiveScroll_Interval: 20
+ - _EmissiveScroll_Velocity: 10
+ - _EmissiveScroll_Width: 10
+ - _FlatOrFullAmbientLighting: 0
+ - _ForceLightDirection: 0
+ - _ForceShadowStrength: 0
+ - _ForegroundEmissionStrength: 1
+ - _ForegroundGradientMax: 0.044
+ - _ForegroundGradientMin: 0.007
+ - _Gloss: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0.5
+ - _GlossyReflections: 1
+ - _GradMin: 0.47
+ - _HardSpecular: 0
+ - _HeightThreshold: 0.98
+ - _MatcapStrength: 1
+ - _MaxBrightness: 100
+ - _Metallic: 0
+ - _MinBrightness: 0
+ - _Mode: 0
+ - _MultiplyMatcap: 0
+ - _NameEmissionStrength: 1
+ - _OcclusionStrength: 1
+ - _Opacity: 0.5
+ - _OutlineStencilCompareFunction: 8
+ - _OutlineStencilFailOp: 0
+ - _OutlineStencilPassOp: 0
+ - _OutlineStencilReadMaskRef: 0
+ - _OutlineStencilRef: 0
+ - _OutlineStencilWriteMaskRef: 0
+ - _OutlineStencilZFailOp: 0
+ - _Parallax: 0.02
+ - _PurelyAdditive: 0
+ - _ReplaceWithMatcap: 0
+ - _RimLightColorBias: 0
+ - _RimSharpness: 0.25
+ - _RimStrength: 0
+ - _RimWidth: 0.8
+ - _Roughness: 0
+ - _SampleWorld: 0
+ - _ScrollingEmission: 0
+ - _ShadowOffset: 0
+ - _ShadowStrength: 1
+ - _SmoothnessTextureChannel: 0
+ - _SourceBlend: 5
+ - _SpecularBias: 0
+ - _SpecularHighlights: 1
+ - _SpecularSize: 0.005
+ - _SpecularStrength: 0
+ - _SrcBlend: 1
+ - _StencilCompareFunction: 8
+ - _StencilFailOp: 0
+ - _StencilPassOp: 0
+ - _StencilReadMaskRef: 0
+ - _StencilRef: 0
+ - _StencilWriteMaskRef: 0
+ - _StencilZFailOp: 0
+ - _UVSec: 0
+ - _UnderWaveEmission: 2
+ - _WaveEmission: 2
+ - _WaveHeight: 0.01
+ - _ZTest: 4
+ - _ZWrite: 1
+ - footer_discord: 0
+ - footer_donate: 0
+ - footer_github: 0
+ - footer_patreon: 0
+ - m_StencilPassOptions: 0
+ - m_emissionOptions: 0
+ - m_end_OutlineStencil: 0
+ - m_end_blinkingEmissionOptions: 0
+ - m_end_mainAdvanced: 0
+ - m_end_scrollingEmissionOptions: 0
+ - m_fakeLightingOptions: 0
+ - m_mainOptions: 0
+ - m_matcapOptions: 0
+ - m_metallicOptions: 0
+ - m_miscOptions: 0
+ - m_rimLightOptions: 0
+ - m_shatterWave: 0
+ - m_specularHighlightsOptions: 0
+ - m_start_OutlineStencil: 0
+ - m_start_blinkingEmissionOptions: 0
+ - m_start_mainAdvanced: 0
+ - m_start_scrollingEmissionOptions: 0
+ - shader_is_using_thry_editor: 69.12
+ - shader_master_label: 0
+ - shader_presets: 0
+ m_Colors:
+ - _BackgroundColor: {r: 0.3069999, g: 0.5271103, b: 1, a: 1}
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+ - _EmissionScrollSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _EmissiveScroll_Direction: {r: 0, g: -10, b: 0, a: 0}
+ - _ForegroundColor: {r: 0.8160377, g: 0.8742405, b: 1, a: 1}
+ - _LightDirection: {r: 0, g: 1, b: 0, a: 0}
+ - _MatcapColor: {r: 1, g: 1, b: 1, a: 1}
+ - _NameColor: {r: 0.18977073, g: 0.33968526, b: 0.6617647, a: 0}
+ - _NamePan: {r: 0.1, g: 0, b: 0, a: 0}
+ - _NoisePan: {r: -0.01, g: 0.2, b: 0, a: 0}
+ - _RimLightColor: {r: 1, g: 1, b: 1, a: 1}
+ - _RimTexPanSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
+ - _Vector0: {r: 1, g: 0, b: 0, a: 0}
+ - _WaveColor: {r: 1, g: 1, b: 1, a: 1}
+ - _WaveDensity: {r: 10, g: 8, b: 9, a: 0}
+ - _WaveSlope: {r: 2, g: 2, b: 2, a: 0}
+ - _WaveSpeed: {r: 0.5, g: 0.6, b: 0.7, a: 0}
+ - _underWaveColor: {r: 1, g: 1, b: 1, a: 1}
+ - float4: {r: 0.1, g: 0, b: 0, a: 0}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial.mat.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial.mat.meta
new file mode 100644
index 00000000..aac06298
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagMaterial.mat.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5099a97f87b34ba43ad02a76c133e414
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagPrefab.prefab b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagPrefab.prefab
new file mode 100644
index 00000000..92e3d081
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagPrefab.prefab
@@ -0,0 +1,84 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1001 &100100000
+Prefab:
+ m_ObjectHideFlags: 1
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 0}
+ m_Modifications: []
+ m_RemovedComponents: []
+ m_ParentPrefab: {fileID: 0}
+ m_RootGameObject: {fileID: 1658155366550740}
+ m_IsPrefabParent: 1
+--- !u!1 &1658155366550740
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 100100000}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 4025044509996960}
+ - component: {fileID: 33168537328311996}
+ - component: {fileID: 23614598367624546}
+ m_Layer: 0
+ m_Name: NameTagPrefab
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &4025044509996960
+Transform:
+ m_ObjectHideFlags: 1
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 100100000}
+ m_GameObject: {fileID: 1658155366550740}
+ m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
+ m_LocalPosition: {x: -8.02, y: 1.408, z: -18.99}
+ m_LocalScale: {x: 71.80795, y: 71.80782, z: 71.80782}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
+--- !u!23 &23614598367624546
+MeshRenderer:
+ m_ObjectHideFlags: 1
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 100100000}
+ m_GameObject: {fileID: 1658155366550740}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 5099a97f87b34ba43ad02a76c133e414, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &33168537328311996
+MeshFilter:
+ m_ObjectHideFlags: 1
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 100100000}
+ m_GameObject: {fileID: 1658155366550740}
+ m_Mesh: {fileID: 4300000, guid: aaa91c8130c7af14db0301debd07d5fa, type: 3}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagPrefab.prefab.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagPrefab.prefab.meta
new file mode 100644
index 00000000..8b257331
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/NameTagPrefab.prefab.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d1176b0782c26cb48b99738c9e5a8884
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 100100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/PoiyomiNameTag.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/PoiyomiNameTag.shader
new file mode 100644
index 00000000..1b305504
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/PoiyomiNameTag.shader
@@ -0,0 +1,179 @@
+Shader ".poiyomi/Patreon/NameTag"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor("", Float)=0
+ _NameTexture ("Name Texture", 2D) = "black" { }
+ _NamePan ("Name Pan", Vector) = (.1, 0, 0, 0)
+ _NoiseTexture ("Noise Texture", 2D) = "white" { }
+ _NoisePan ("Noise Pan", Vector) = (0, .3, 0, 0)
+
+ _ForegroundColor ("Foreground Color", Color) = (1, 1, 1, 1)
+ _BackgroundColor ("Background Color", Color) = (1, .1, .1, 1)
+ _NameColor ("Name Color", Color) = (0, 0, 0, 0)
+
+ _ForegroundGradientMin ("Foreground Gradient Min", Range(0, 1)) = .2
+ _ForegroundGradientMax ("Foreground Gradient Max", Range(0, 1)) = .25
+ _BackgroundGradientMin ("Background Gradient Min", Range(0, 1)) = .25
+ _BackgroundGradientMax ("Background Gradient Max", Range(0, 1)) = .4
+
+ _EmissionStrength ("Emission Strength", Float) = 1
+ }
+
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Blend SrcAlpha OneMinusSrcAlpha
+ Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
+ LOD 100
+ CGINCLUDE
+ #pragma target 5.0
+ ENDCG
+
+ ColorMask RGBA
+ Offset 0, 0
+
+ Pass
+ {
+ Cull Front
+ Name "Back"
+ CGPROGRAM
+
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma multi_compile_instancing
+ #include "UnityCG.cginc"
+
+ sampler2D _NameTexture; float4 _NameTexture_ST;
+ sampler2D _NoiseTexture; float4 _NoiseTexture_ST;
+ float4 _ForegroundColor, _BackgroundColor, _NameColor, _NoisePan, _NamePan;
+ float _ForegroundGradientMin, _ForegroundGradientMax, _BackgroundGradientMin, _BackgroundGradientMax, _EmissionStrength;
+
+ struct appdata
+ {
+ float4 vertex: POSITION;
+ float2 texcoord: TEXCOORD0;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ float2 uv: TEXCOORD0;
+ UNITY_VERTEX_OUTPUT_STEREO
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ v2f vert(appdata v)
+ {
+ v2f o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ o.uv = float4(v.texcoord.xy, 0, 0);
+ o.pos = UnityObjectToClipPos(v.vertex);
+ return o;
+ }
+
+ fixed4 frag(v2f i): SV_Target
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+
+ float distanceFromCenter = distance(0.5, i.uv.y);
+ float nameTexture = tex2D(_NameTexture, TRANSFORM_TEX(i.uv, _NameTexture) + (_Time.y * _NamePan.xy));
+ float noiseTexture = 1 - tex2D(_NoiseTexture, TRANSFORM_TEX(i.uv, _NoiseTexture) + (_Time.y * _NoisePan.xy));
+
+ float foregroundGradient = (1 - smoothstep(_ForegroundGradientMin, _ForegroundGradientMax, distanceFromCenter));
+ float backgroundGradient = (1 - smoothstep(_BackgroundGradientMin, _BackgroundGradientMax, distanceFromCenter));
+
+ float foregroundColorMask = saturate(foregroundGradient - noiseTexture * (1 - foregroundGradient));
+ float backgroundColorMask = saturate(backgroundGradient - noiseTexture * (1 - backgroundGradient));
+
+ float4 foregroundColor = float4(_ForegroundColor.rgb, foregroundColorMask);
+ float4 backgroundColor = float4(_BackgroundColor.rgb, backgroundColorMask);
+
+ fixed4 finalColor = float4(_BackgroundColor.rgb, 0);
+
+ finalColor = lerp(finalColor, _BackgroundColor, backgroundColorMask);
+ finalColor = lerp(finalColor, _ForegroundColor, foregroundColorMask);
+ finalColor = lerp(finalColor, _NameColor, nameTexture);
+ finalColor.rgb *= _EmissionStrength;
+ return finalColor;
+ }
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Cull Back
+
+ Name "Front"
+ CGPROGRAM
+
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma multi_compile_instancing
+ #include "UnityCG.cginc"
+
+ sampler2D _NameTexture; float4 _NameTexture_ST;
+ sampler2D _NoiseTexture; float4 _NoiseTexture_ST;
+ float4 _ForegroundColor, _BackgroundColor, _NameColor, _NoisePan, _NamePan;
+ float _ForegroundGradientMin, _ForegroundGradientMax, _BackgroundGradientMin, _BackgroundGradientMax, _EmissionStrength;
+
+ struct appdata
+ {
+ float4 vertex: POSITION;
+ float2 texcoord: TEXCOORD0;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ float2 uv: TEXCOORD0;
+ UNITY_VERTEX_OUTPUT_STEREO
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ v2f vert(appdata v)
+ {
+ v2f o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ o.uv = float4(v.texcoord.xy, 0, 0);
+ o.pos = UnityObjectToClipPos(v.vertex);
+ return o;
+ }
+
+ fixed4 frag(v2f i): SV_Target
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+
+ float distanceFromCenter = distance(0.5, i.uv.y);
+ float nameTexture = tex2D(_NameTexture, TRANSFORM_TEX(i.uv, _NameTexture) + (_Time.y * _NamePan.xy));
+ float noiseTexture = 1 - tex2D(_NoiseTexture, TRANSFORM_TEX(i.uv, _NoiseTexture) + (_Time.y * _NoisePan.xy));
+
+ float foregroundGradient = (1 - smoothstep(_ForegroundGradientMin, _ForegroundGradientMax, distanceFromCenter));
+ float backgroundGradient = (1 - smoothstep(_BackgroundGradientMin, _BackgroundGradientMax, distanceFromCenter));
+
+ float foregroundColorMask = saturate(foregroundGradient - noiseTexture * (1 - foregroundGradient));
+ float backgroundColorMask = saturate(backgroundGradient - noiseTexture * (1 - backgroundGradient));
+
+ float4 foregroundColor = float4(_ForegroundColor.rgb, foregroundColorMask);
+ float4 backgroundColor = float4(_BackgroundColor.rgb, backgroundColorMask);
+
+ fixed4 finalColor = float4(_BackgroundColor.rgb, 0);
+
+ finalColor = lerp(finalColor, _BackgroundColor, backgroundColorMask);
+ finalColor = lerp(finalColor, _ForegroundColor, foregroundColorMask);
+ finalColor = lerp(finalColor, _NameColor, nameTexture);
+ finalColor.rgb *= _EmissionStrength;
+ return finalColor;
+ }
+ ENDCG
+
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/PoiyomiNameTag.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/PoiyomiNameTag.shader.meta
new file mode 100644
index 00000000..a9f8614c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/PoiyomiNameTag.shader.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3640220fcd5a3664b9e7135a1c1a1ed4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/Ring (1).fbx b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/Ring (1).fbx
new file mode 100755
index 00000000..dc396f57
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/Ring (1).fbx
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/Ring (1).fbx.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/Ring (1).fbx.meta
new file mode 100644
index 00000000..7864bda8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/Ring (1).fbx.meta
@@ -0,0 +1,91 @@
+fileFormatVersion: 2
+guid: aaa91c8130c7af14db0301debd07d5fa
+ModelImporter:
+ serializedVersion: 22
+ fileIDToRecycleName:
+ 100000: //RootNode
+ 400000: //RootNode
+ 2100000: No Name
+ 2300000: //RootNode
+ 3300000: //RootNode
+ 4300000: Cylinder
+ externalObjects: {}
+ materials:
+ importMaterials: 1
+ materialName: 0
+ materialSearch: 1
+ materialLocation: 1
+ animations:
+ legacyGenerateAnimations: 4
+ bakeSimulation: 0
+ resampleCurves: 1
+ optimizeGameObjects: 0
+ motionNodeName:
+ rigImportErrors:
+ rigImportWarnings:
+ animationImportErrors:
+ animationImportWarnings:
+ animationRetargetingWarnings:
+ animationDoRetargetingWarnings: 0
+ importAnimatedCustomProperties: 0
+ animationCompression: 1
+ animationRotationError: 0.5
+ animationPositionError: 0.5
+ animationScaleError: 0.5
+ animationWrapMode: 0
+ extraExposedTransformPaths: []
+ extraUserProperties: []
+ clipAnimations: []
+ isReadable: 1
+ meshes:
+ lODScreenPercentages: []
+ globalScale: 1
+ meshCompression: 0
+ addColliders: 0
+ importVisibility: 1
+ importBlendShapes: 1
+ importCameras: 1
+ importLights: 1
+ swapUVChannels: 0
+ generateSecondaryUV: 0
+ useFileUnits: 1
+ optimizeMeshForGPU: 1
+ keepQuads: 0
+ weldVertices: 1
+ preserveHierarchy: 0
+ indexFormat: 0
+ secondaryUVAngleDistortion: 8
+ secondaryUVAreaDistortion: 15.000001
+ secondaryUVHardAngle: 88
+ secondaryUVPackMargin: 4
+ useFileScale: 1
+ tangentSpace:
+ normalSmoothAngle: 60
+ normalImportMode: 0
+ tangentImportMode: 3
+ normalCalculationMode: 4
+ importAnimation: 1
+ copyAvatar: 0
+ humanDescription:
+ serializedVersion: 2
+ human: []
+ skeleton: []
+ armTwist: 0.5
+ foreArmTwist: 0.5
+ upperLegTwist: 0.5
+ legTwist: 0.5
+ armStretch: 0.05
+ legStretch: 0.05
+ feetSpacing: 0
+ rootMotionBoneName:
+ rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
+ hasTranslationDoF: 0
+ hasExtraRoot: 0
+ skeletonHasParents: 1
+ lastHumanDescriptionAvatarSource: {instanceID: 0}
+ animationType: 0
+ humanoidOversampling: 1
+ additionalBone: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/YourName.png b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/YourName.png
new file mode 100755
index 00000000..2f779f0e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/YourName.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/YourName.png.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/YourName.png.meta
new file mode 100644
index 00000000..b69e9c54
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/YourName.png.meta
@@ -0,0 +1,76 @@
+fileFormatVersion: 2
+guid: 129da761178f60b42b1bc6a528fed6c9
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 4
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -1
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ spritePackingTag:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/poiyomi.png b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/poiyomi.png
new file mode 100755
index 00000000..41fe2fd3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/poiyomi.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/poiyomi.png.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/poiyomi.png.meta
new file mode 100644
index 00000000..956b6264
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/NameTag/poiyomi.png.meta
@@ -0,0 +1,99 @@
+fileFormatVersion: 2
+guid: 0ed883f8f92c31f4d87de788be1e5ab2
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 1
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 2
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ - serializedVersion: 2
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPC.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPC.shader
new file mode 100644
index 00000000..0a628ae4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPC.shader
@@ -0,0 +1,1244 @@
+Shader ".poiyomi/Patreon/Tessellation/Cutout"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#ff0000ff>❤</color> <color=#000000ff>Poiyomi Pro V6.1</color> <color=#ff0000ff>❤</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+ [HideInInspector] shader_properties_label_file ("PoiLabels", Float) = 0
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ // Main
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _MainTex ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 1)) = 0
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AlphaMaskUV ("UV", Int) = 0
+
+ //Hue Shifting
+ [HideInInspector] m_start_MainHueShift ("Hue Shift", Float) = 0
+ [HideInInspector][ToggleUI]_MainHueShiftToggle ("Toggle Hueshift", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Replace?", Float) = 1
+ _MainHueShift ("Hue Shift", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Shift Speed", Float) = 0
+ _MainHueShiftMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainHueShiftMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainHueShiftMaskUV ("UV", Int) = 0
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ // RGB Masking
+ [HideInInspector] m_start_RGBMask ("RGB Color Masking", Float) = 0
+ [HideInInspector][Toggle(FXAA)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ _RGBMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBMaskPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color", Color) = (1, 1, 1, 1)
+ _RedTexure ("R Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBRedPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBRed_UV ("UV", int) = 0
+ _GreenColor ("G Color", Color) = (1, 1, 1, 1)
+ _GreenTexture ("G Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBGreenPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBGreen_UV ("UV", int) = 0
+ _BlueColor ("B Color", Color) = (1, 1, 1, 1)
+ _BlueTexture ("B Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBBluePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBBlue_UV ("UV", int) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Detail Options
+ [HideInInspector] m_start_DetailOptions ("Details", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture Tint", Color) = (1, 1, 1)
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ //Vertex Manipulations
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map", 2D) = "while" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Division Amount", Float) = 500
+ [HideInInspector] m_end_vertexManipulation ("Vertex Options", Float) = 0
+
+ // Alpha Options
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.01
+ [ToggleUI]_DitheringEnabled ("Enable Dithering", Float) = 1
+ _DitherGradient ("Dither Gradient", Range(0, 1)) = .1
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 0
+ _MainShadowClipMod ("Shadow Clip Mod", Range(-1, 1)) = 0
+ [Enum(Off, 0, On, 1)] _AlphaToMask ("Alpha To Coverage", Float) = 0
+ [ToggleUI]_MainAlphaToCoverage ("Sharpenned A2C--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Float) = 0
+ _MainMipScale ("Mip Level Alpha Scale--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Range(0, 1)) = 0.25
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decal", Float) = 0
+ [HideInInspector][Toggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ _DecalColor ("Color", Color) = (1, 1, 1, 1)
+ _DecalTexture ("Decal", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalTextureUV ("UV", Int) = 0
+ _DecalMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalMaskUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ _DecalBlendAdd ("Add", Range(0, 1)) = 0
+ _DecalBlendMultiply ("Multiply", Range(0, 1)) = 0
+ _DecalBlendReplace ("Replace", Range(0, 1)) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face", Float) = 0
+ [ToggleUI]_BackFaceEnabled ("Enable Back Face Options", Float) = 0
+ _BackFaceTexture ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFacePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ _BackFaceHueShift ("Hue Shift", Range(0, 1)) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingOptions ("Lighting", Float) = 0
+ [HideInInspector] m_start_Lighting ("Light and Shadow", Float) = 0
+ [Toggle(LOD_FADE_CROSSFADE)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Natural, 0, Controlled, 1, Standardish, 2, Math, 3)] _LightingType ("Lighting Type", Int) = 1
+ [ToggleUI]_LightingMonochromatic ("Monochromatic?", Float) = 0
+ _LightingGradientStart ("Gradient Start--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = .5
+ _LightingStartColor ("Light Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ _LightingEndColor ("Shadow Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", 2D) = "white" { }
+ _LightingShadowMask ("Shadow Mask (RGBA)--{reference_properties:[_LightingShadowMaskPan, _LightingShadowMaskUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingShadowMaskUV ("UV", Int) = 0
+ _ShadowStrength ("Shadow Strength--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(0, 1)) = .2
+ _ShadowOffset ("Shadow Offset--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(-1, 1)) = 0
+ _LightingAOTex ("AO Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingAOTexUV ("UV", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 0
+ _LightingMinLightBrightness ("Min Brightness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 0
+ _LightingIndirectContribution ("Indirect Contribution--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = .2
+ _AttenuationMultiplier ("Recieve Casted Shadows?", Range(0, 1)) = 0
+ _LightingDetailShadows ("Detail Shadows--{reference_properties:[_LightingDetailShadowsPan, _LightingDetailShadowsUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingDetailShadowsUV ("UV", Int) = 0
+ _LightingDetailStrength ("Detail Strength--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 1
+ _LightingStandardSmoothness ("Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==2}}", Range(0, 1)) = 0
+
+ // Lighting Beta Options
+ [HideInInspector] m_start_lightingBeta ("Extra Ramps--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Float) = 0
+ _LightingNoIndirectThreshold ("Absent Indirect Threshold", Range(0, 1)) = 0.01
+ _LightingNoIndirectMultiplier ("Absent Indirect Multiplier", Range(0, 1)) = 0.5
+ [ToggleUI]_LightingStandardControlsToon ("Standard Lighting Controls Toon Ramp", Float) = 0
+ [IntRange]_LightingNumRamps ("Num Ramps", Range(1, 3)) = 1
+ [Gradient]_ToonRamp1 ("Lighting Ramp 2", 2D) = "white" { }
+ _LightingShadowStrength1 ("Shadow Strength 2", Range(0, 1)) = 1
+ _ShadowOffset1 ("Shadow Offset 2", Range(-1, 1)) = 0
+ [Gradient]_ToonRamp2 ("Lighting Ramp 3", 2D) = "white" { }
+ _LightingShadowStrength2 ("Shadow Strength 3", Range(0, 1)) = 1
+ _ShadowOffset2 ("Shadow Offset 3", Range(-1, 1)) = 0
+ [HideInInspector] m_end_lightingBeta ("Extra Ramps", Float) = 0
+
+ // point/spot Light Settings
+ [HideInInspector] m_start_lightingAdvanced ("Additive Lighting", Float) = 0
+ [Enum(Standard, 0, Controlled, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End", Range(0, 1)) = .5
+ _LightingAdditivePassthrough ("Point Light Passthrough", Range(0, 1)) = .5
+ _LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_lightingAdvanced ("Additive Lighting", Float) = 0
+ [HideInInspector] m_end_Lighting ("Light and Shadow", Float) = 0
+
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [Toggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSSCale ("Light Strength", Range(0, 1)) = 0.25
+ _SSSPower ("Light Spread", Range(1, 100)) = 5
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting", Float) = 0
+ [Toggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [Enum(vertex, 0, pixel, 1)] _RimLightNormal ("Normal Select", Int) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimMaskUV ("UV", Int) = 0
+
+ // Rim Noise
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_RimWidthNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimWidthNoiseTextureUV ("UV", Int) = 0
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Environmental Rim Lighting
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [Toggle(_MAPPING_6_FRAMES_LAYOUT)]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+
+ // Baked Lighting
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ // Metallics
+ [HideInInspector] m_start_Metallic ("Metallics", Float) = 0
+ [Toggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicTintMap ("Tint Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicTintMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicTintMapUV ("UV", Int) = 0
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicMaskUV ("UV", Int) = 0
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SmoothnessMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SmoothnessMaskUV ("UV", Int) = 0
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_Metallic ("Metallics", Float) = 0
+
+ // Clearcoat
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [Toggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ _ClearCoatCubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearCoatSampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearCoatMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatMaskUV ("UV", Int) = 0
+ _ClearCoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearCoatSmoothnessMap ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatSmoothnessMapUV ("UV", Int) = 0
+ [ToggleUI]_ClearCoatInvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 0
+ [ToggleUI]_ClearCoatForceLighting ("Force Lighting", Float) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap / Sphere Textures", Float) = 0
+ [Toggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MatcapMaskUV ("UV", Int) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_matcap ("Matcap", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ToggleUI]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _Matcap2MaskUV ("UV", Int) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ // Specular
+ [HideInInspector] m_start_specular ("Specular Reflections", Float) = 0
+ [Toggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal ("Normal Select", Int) = 1
+ _SpecularAttenuation ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType==3}}}", Range(0, 1)) = 1
+ [Gradient]_SpecularMap ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMapUV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMaskUV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ // Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _Spec1Offset ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMapPan, _AnisoTangentMapUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMapUV ("UV", Int) = 0
+ //toon aniso
+ _SpecularToonStart ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicroPan, _SpecularAnisoJitterMicroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacroPan, _SpecularAnisoJitterMacroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMacroUV ("UV", Int) = 0
+ // Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular ("Specular Reflections", Float) = 0
+
+ // Second Specular
+ [HideInInspector] m_start_specular1 ("Specular Reflections 2", Float) = 0
+ [ToggleUI]_EnableSpecular1 ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType1 ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal1 ("Normal Select", Int) = 1
+ _SpecularAttenuation1 ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint1 ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic1 ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness1 ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==3}}}", Range(-2, 1)) = .75
+ _SpecularMap1 ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMap1UV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness1 ("Invert Smoothness", Float) = 0
+ _SpecularMask1 ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMask1UV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom1 ("Smoothness From", Int) = 1
+ // Second Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent1 ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Int) = 0
+ _AnisoSpec1Alpha1 ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha1 ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _Spec1Offset1 ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness1 ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap1 ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Float) = 0
+ _AnisoTangentMap1 ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMap1Pan, _AnisoTangentMap1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMap1UV ("UV", Int) = 0
+ // Second toon aniso
+ _SpecularToonStart1 ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd1 ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor1 ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored1("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro1 ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicro1Pan, _SpecularAnisoJitterMicro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier1 ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicro1UV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro1 ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacro1Pan, _SpecularAnisoJitterMacro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier1 ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMacro1UV ("UV", Int) = 0
+ // Second Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter1 ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular1 ("Specular Reflections", Float) = 0
+
+ // Fist Emission
+ [HideInInspector] m_Special_Effects ("Special Effects", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission / Glow", Float) = 0
+ [Toggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMapUV ("UV", Int) = 0
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMaskUV ("UV", Int) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0
+
+ // Center out emission
+ [HideInInspector] m_start_CenterOutEmission ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission ("inward out emission", Float) = 0
+
+ // Glow in the dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ // Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ _EmissionScrollingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emissionOptions ("Emission / Glow", Float) = 0
+
+ // Second Enission
+ [HideInInspector] m_start_emission1Options ("Emission / Glow 2 (Requires Emission 1 Enabled)", Float) = 0
+ [ToggleUI]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap1 ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMap1UV ("UV", Int) = 0
+ _EmissionMask1 ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMask1UV ("UV", Int) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled1 ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0
+
+ // Second Center Out Enission
+ [HideInInspector] m_start_CenterOutEmission1 ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled1 ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission1 ("inward out emission", Float) = 0
+
+ // Second Glow In The Dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission1 ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Second Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max1 ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+
+ // Scrolling Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions1 ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission1 ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction1 ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval", Float) = 20
+ _EmissionScrollingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmission1Options ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emission1Options ("Emission / Glow 2", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook", Float) = 0
+ [Toggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookTexArrayUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookMaskUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Int) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+
+ // Flipbook Manual Control
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve", Float) = 0
+ [Toggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolved Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Noise", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Detail Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_dissolveMasking ("Effect Masking", Float) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmissionSide ("Emission 1", Int) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmission1Side ("Emission 2", Int) = 0
+ [HideInInspector] m_end_dissolveMasking ("Effect Masking", Float) = 0
+
+ // Point to Point Dissolve
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Panosphere
+ [HideInInspector] m_start_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [Toggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ [ToggleUI]_PanoInfiniteStereoToggle ("Infinite Stereo", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_PanoMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _PanoMaskUV ("UV", Int) = 0
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+ [HideInInspector] m_end_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle", Float) = 0
+ [Toggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ //[Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Type", Int) = 0
+ [HDR]_GlitterColor ("Color", Color) = (1, 1, 1)
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Wobble Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias", Range(0, 1)) = .8
+
+ // Glitter Random Colors
+ [HideInInspector] m_start_glitterRandom ("Random Colors", Float) = 0
+ [ToggleUI]_GlitterRandomColors ("Enable", Float) = 0
+ [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1)
+ [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1)
+ [HideInInspector] m_end_glitterRandom ("Random Colors", Float) = 0
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("MSDF Text Overlay", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [Toggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS", Float) = 0
+ [ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color", Color) = (1, 1, 1, 1)
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextFPS ("FPS", Float) = 0
+
+ // POSITION
+ [HideInInspector] m_start_TextPosition ("Position", Float) = 0
+ [ToggleUI]_TextPositionEnabled ("Position Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color", Color) = (1, 0, 1, 1)
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextPosition ("Position", Float) = 0
+
+ // INSTANCE TIME
+ [HideInInspector] m_start_TextInstanceTime ("Instance Time", Float) = 0
+ [ToggleUI]_TextTimeEnabled ("Time Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color", Color) = (1, 0, 1, 1)
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror", Float) = 0
+ [Toggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MirrorTextureUV ("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ // Distance Fade
+ [HideInInspector] m_start_distanceFade ("Distance Fade", Float) = 0
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainFadeTexture ("Fade Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainFadeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainFadeTextureUV ("UV", Int) = 0
+ [Vector2]_MainDistanceFade ("Distance Fade X to Y", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_distanceFade ("Distance Fade", Float) = 0
+
+ // Angular Fade
+ [HideInInspector] m_start_angularFade ("Angular Fade", Float) = 0
+ [Toggle(_SUNDISK_NONE)]_EnableRandom ("Enable Angular Fade", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_angularFade ("Angular Fade", Float) = 0
+
+ // UV Distortion
+ [HideInInspector] m_start_distortionFlow ("UV Distortion", Float) = 0
+ [Toggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ _DistortionFlowTexture ("Distortion Texture 1", 2D) = "black" { }
+ _DistortionFlowTexture1 ("Distortion Texture 2", 2D) = "black" { }
+ _DistortionStrength ("Strength1", Float) = 0.5
+ _DistortionStrength1 ("Strength2", Float) = 0.5
+ [Vector2]_DistortionSpeed ("Speed1", Vector) = (0.5, 0.5, 0, 0)
+ [Vector2]_DistortionSpeed1 ("Speed2", Vector) = (0.5, 0.5, 0, 0)
+ [HideInInspector] m_end_distortionFlow ("UV Distortion", Float) = 0
+
+ // Start Patreon
+ [HideInInspector] m_Patreon ("Patreon", Float) = 0
+ [HideInInspector] m_start_Video ("Video", Float) = 0
+ [Toggle(BLOOM)] _EnableVideo ("Enable Video", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VideoUVNumber ("Screen UV#", Int) = 0
+ [Enum(LCD, 0, TN, 1, CRT, 2, OLED, 3, Gameboy, 4, Projector, 5)] _VideoType ("Screen Type", Int) = 3
+ _VideoBacklight ("Brightness", Range(0, 100)) = 1
+ _VideoPixelTexture ("Pixel Texture", 2D) = "white" { }
+ [Vector2]_VideoResolution ("Resolution", Vector) = (1280, 720, 0)
+ _VideoMaskTexture ("Mask", 2D) = "white" { }
+ [Vector2]_VideoMaskPanning ("Mask Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_VideoSettings ("Video Texture Settings", Float) = 0
+ [ToggleUI]_VideoEnableVideoPlayer ("Enable Video Player", Float) = 0
+ [ToggleUI]_VideoPixelateToResolution ("Pixelate To Resolution", Float) = 0
+ [ToggleUI]_VideoRepeatVideoTexture ("Clamp To UV", Float) = 0
+ [Vector2]_VideoPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_VideoTiling ("Tiling", Vector) = (1, 1, 0, 0)
+ [Vector2]_VideoOffset ("Offset", Vector) = (0, 0, 0, 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_VideoDebug ("Video Debug", Float) = 0
+ [ToggleUI]_VideoEnableDebug ("Enable Debug", Float) = 0
+ _VideoDebugTexture ("Video Debug Tex", 2D) = "white" { }
+ [HideInInspector] m_end_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_start_CRT ("CRT Options", 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", Float) = 0
+ [Gradient]_VideoGameboyRamp ("Color Ramp", 2D) = "white" { }
+ [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Video ("Video", Float) = 0
+
+ [HideInInspector] m_start_TouchOptions ("Touch FX", Float) = 0
+ [HideInInspector] m_start_Bulge ("Bulge", Float) = 0
+ [Toggle(BLOOM_LOW)] _EnableBulge ("Bulge", Float) = 0
+ _BulgeMask ("Bulge Mask", 2D) = "white" { }
+ _BuldgeFadeLength ("Touch Distance", Float) = 0.02
+ _BuldgeHeight ("Bulge Height", Range(-0.2, 0.2)) = 0.02
+ [HideInInspector] m_end_Bulge ("Bulge", Float) = 0
+
+ [HideInInspector] m_start_TouchGlow ("Touch Color", Float) = 0
+ [Toggle(GRAIN)]_EnableTouchGlow ("Enable Touch Glow", Float) = 0
+ _DepthGlowColor ("Depth Glow Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DepthGradient ("Depth Gradient", 2D) = "white" { }
+ _DepthMask ("Depth Mask", 2D) = "white" { }
+ _DepthGlowEmission ("Depth Glow Emission", Float) = 3
+ _FadeLength ("Fade Length", Float) = 0.02
+ _DepthAlphaMin ("Alpha Min", Range(0, 1)) = 1
+ _DepthAlphaMax ("Alpha Max", Range(0, 1)) = 1
+ [HideInInspector] m_end_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchOptions ("Touch FX", Float) = 0
+
+ [HideInInspector] m_start_Hologram ("Hologram Alpha", Float) = 0
+ [Toggle(DEPTH_OF_FIELD)]_EnableHolo ("Enable Hologram Alpha", Float) = 0
+ [Curve]_HoloAlphaMap ("Alpha Map", 2D) = "white" { }
+ [Enum(World Space, 0, Local Space, 1, UV, 2)]_HoloCoordinateSpace ("Coordinate Space", Int) = 0
+ _HoloDirection ("Scroll Direction", Vector) = (0, 1, 0)
+ _HoloLineDensity ("Line Density", Float) = 10
+ _HoloScrollSpeed ("Scroll Speed", Float) = 1
+ [HideInInspector] m_start_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ _HoloFresnelAlpha ("Intensity", Range(0, 1)) = 0
+ _HoloRimSharpness ("Sharpness", Range(0, 1)) = .5
+ _HoloRimWidth ("Width", Range(0, 1)) = .5
+ [HideInInspector] m_end_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_Hologram ("Hologram Alpha", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence", Float) = 0
+ [Toggle(BLOOM_LENS_DIRT)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp", 2D) = "white" { }
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map", 2D) = "bump" { }
+ _IridescenceMask ("Mask", 2D) = "white" { }
+ _IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceNormalUV ("Normal UV", Int) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceMaskUV ("Mask UV", Int) = 0
+ [Enum(vertex, 0, pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Enum(Run Early, 0, Run Late, 1)] _IridescenceTime ("When To Run", Int) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ [HideInInspector] m_start_VertexGlitch ("Vertex Glitching", Float) = 0
+ [ToggleUI]_EnableVertexGlitch ("Enable Vertex Glitching", Float) = 0
+ _VertexGlitchFrequency ("Glitch Interval", Float) = 0
+ _VertexGlitchThreshold ("Glitch Threshold", Range(0, 1)) = 1
+ _VertexGlitchStrength ("Glitch Strength", Range(0, 10)) = 1
+ [HideInInspector] m_end_VertexGlitch ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_Spawns ("Spawns", Float) = 0
+ [HideInInspector] m_start_ScifiSpawnIn ("Sci Fi", Float) = 0
+ [ToggleUI]_EnableScifiSpawnIn ("Enable Sci Fi Spawn", Float) = 0
+ _SpawnInNoise ("Spawn Noise", 2D) = "black" { }
+ _SpawnInNoiseIntensity ("Noise Intensity", Range(0, 1)) = .35
+ _SpawnInAlpha ("Spawn Alpha", Range(0, 1)) = 0
+ [Vector3]_SpawnInGradientStart ("Gradient Start", Vector) = (0, 2, 0)
+ [Vector3]_SpawnInGradientFinish ("Gradient End", Vector) = (0, -2, 0)
+ [HDR]_SpawnInEmissionColor ("Emission Color", Color) = (1, 1, 1)
+ _SpawnInEmissionOffset ("Emission Width", Range(0, 1)) = .1
+ _SpawnInVertOffset ("Vertex Offset Speed", Float) = 10
+ _SpawnInVertOffsetOffset ("vert width", Range(0, 1)) = .1
+ [HideInInspector] m_end_SciFiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_Spawns ("Spawns", Float) = 0
+
+ [HideInInspector] m_start_Tessellation ("Tessellation", Float) = 0
+ _TessellationPhongStrength ("Phong Strength", Range(0, 1)) = 0.5
+ _TessellationEdgeLength ("Edge Length", Range(2, 50)) = 5
+ _TessellationExtrusionAmount ("Extrusion", Range(-0.005, 0.005)) = 0.0
+ //[Toggle(_FADING_ON)]_EnableUniformTessellation ("Uniform Tessellation", Float) = 0
+ //_TessellationUniform ("Uniform", Range(1,64)) = 5
+ [HideInInspector] m_end_Tessellation ("Tessellation", Float) = 0
+
+ // Voronoi
+ [HideInInspector] m_start_Voronoi ("Vertex Glitching", Float) = 0
+ [Enum(2D (Fast), 0, 3D (Fast with color bugs), 1, 3D (slow but no bugs), 2)] _VoronoiType ("Space", Int) = 1
+ [Enum(Local, 0, World, 1, UV, 2)] _VoronoiSpace ("Space", Int) = 0
+ [Enum(Color and Emission, 0, Just Emission, 1)] _VoronoiBlend ("Blend", Int) = 0
+ [Toggle(CHROMATIC_ABERRATION)]_EnableVoronoi ("Enable Voronoi", Float) = 0
+ _VoronoiMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_VoronoiMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiMaskUV ("UV", Int) = 0
+ _VoronoiNoise ("Edge Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_VoronoiNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiNoiseUV ("UV", Int) = 0
+ _VoronoiNoiseIntensity ("Noise Intensity", Range(0,1)) = .1
+ _VoronoiColor0 ("Color 0", Color) = (0, 0, 0, 1)
+ _VoronoiEmission0 ("Emission 0", Range(0, 20)) = 0
+ _VoronoiColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ _VoronoiEmission1 ("Emission 1", Range(0, 20)) = 0
+ [Vector2]_VoronoiGradient ("Gradient", Vector) = (.04, .05, 0, 0)
+ _VoronoiScale ("Scale", Float) = 5
+ [Vector3]_VoronoiSpeed ("Speed", Vector) = (3, 3, 3)
+ [HideInInspector] m_start_voronoiRandom("Voronoi Random Cell Color", Float) = 0
+ [ToggleUI]_VoronoiEnableRandomCellColor ("Rando Cell Col", Float) = 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_end_Voronoi ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_BlackLight ("Black Light Mask", Float) = 0
+ [HideInInspector][Toggle(_SPECULARHIGHLIGHTS_OFF)]_BlackLightMaskEnabled ("Black Light Mask Enabled", Float) = 0
+ _BlackLightMaskKeys ("Mask Keys", Vector) = (2, 3, 4, 5)
+ _BlackLightMaskStart ("Gradient Start", Vector) = (0, 0, 0, 0)
+ _BlackLightMaskEnd ("Gradient End", Vector) = (1, 1, 1, 1)
+ [ToggleUI]_BlackLightMaskDebug ("Visualize", Float) = 0
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMetallic ("Metallic", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskClearCoat ("Clear Coat", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap ("Matcap 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap2 ("Matcap 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission ("Emission 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission2 ("Emission 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskFlipbook ("Flipbook", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskDissolve ("Dissolve", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskPanosphere ("Panosphere", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskGlitter ("Glitter", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskIridescence ("Iridescence", Int) = 4
+ [HideInInspector] m_end_BlackLight ("Black Light", Float) = 0
+ // End Patreon
+
+ // Parallax Mapping
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [Toggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ [Vector2]_ParallaxHeightMapPan ("Pan", Vector) = (0, 0, 0, 0)
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ParallaxUV ("Parallax UV", Int) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxHeightMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxHeightMapMaskUV ("UV", Int) = 0
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxInternalMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxInternalMapMaskUV ("UV", Int) = 0
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+ [HideInInspector] m_start_parallaxAdvanced ("Advanced", Float) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxAdvanced ("Advanced", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ _ZBias ("ZBias", Float) = 0.0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Debug Options
+ [HideInInspector] m_start_debugOptions ("Debug", Float) = 0
+ [HideInInspector][Toggle(_COLOROVERLAY_ON)]_DebugEnabled ("Display Debug Info", Float) = 0
+ _VertexUnwrap ("Unwrap", Range(0, 1)) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ [HideInInspector] m_end_debugOptions ("Debug", Float) = 0
+ }
+
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "RenderType" = "TransparentCutout" "Queue" = "AlphaTest+10" }
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.6
+ #define FORWARD_BASE_PASS
+ #define CUTOUT
+ #define TESSELATION
+ // Base Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // patreon Base
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // Uniform Tessellation
+ #pragma shader_feature _FADING_ON
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Touch Color
+ #pragma shader_feature GRAIN
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex poiTessellationVert
+ #pragma hull poiHull
+ #pragma domain poiDomain
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.6
+ #define FORWARD_ADD_PASS
+ #define BINORMAL_PER_FRAGMENT
+ #define CUTOUT
+ #define TESSELATION
+ // Add Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // Uniform Tessellation
+ #pragma shader_feature _FADING_ON
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex poiTessellationVert
+ #pragma hull poiHull
+ #pragma domain poiDomain
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.6
+ #define CUTOUT
+ #define POI_SHADOW
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/CGI_PoiPassShadow.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+ Cull Off
+ CGPROGRAM
+
+ #define POI_META_PASS
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ }
+ Fallback "Toon/Lit Cutout (Double)"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPC.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPC.shader.meta
new file mode 100644
index 00000000..e5241817
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPC.shader.meta
@@ -0,0 +1,84 @@
+fileFormatVersion: 2
+guid: d424a565152373e46b4161cf169df45f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {fileID: 2800000, guid: a6d6984545cde4a4f9317b17d6dca225, type: 3}
+ - _BumpMap: {instanceID: 0}
+ - _AlphaMask: {instanceID: 0}
+ - _RGBMask: {instanceID: 0}
+ - _RedTexure: {instanceID: 0}
+ - _GreenTexture: {instanceID: 0}
+ - _BlueTexture: {instanceID: 0}
+ - _DetailMask: {instanceID: 0}
+ - _DetailTex: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _VertexManipulationHeightMask: {instanceID: 0}
+ - _BackFaceTexture: {instanceID: 0}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ - _LightingShadowMask: {instanceID: 0}
+ - _AOMap: {instanceID: 0}
+ - _ToonRamp1: {instanceID: 0}
+ - _ToonRamp2: {instanceID: 0}
+ - _SSSThicknessMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ - _RimMask: {instanceID: 0}
+ - _RimWidthNoiseTexture: {instanceID: 0}
+ - _RimEnviroMask: {instanceID: 0}
+ - _CubeMap: {instanceID: 0}
+ - _MetallicMask: {instanceID: 0}
+ - _SmoothnessMask: {instanceID: 0}
+ - _ClearCoatCubeMap: {instanceID: 0}
+ - _ClearCoatMask: {instanceID: 0}
+ - _ClearCoatSmoothnessMask: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMask: {instanceID: 0}
+ - _Matcap2: {instanceID: 0}
+ - _Matcap2Mask: {instanceID: 0}
+ - _SpecularMap: {instanceID: 0}
+ - _SpecularMask: {instanceID: 0}
+ - _AnisoTangentMap: {instanceID: 0}
+ - _SpecularMap1: {instanceID: 0}
+ - _SpecularMask1: {instanceID: 0}
+ - _AnisoTangentMap1: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _EmissionScrollingCurve: {instanceID: 0}
+ - _EmissionMap1: {instanceID: 0}
+ - _EmissionMask1: {instanceID: 0}
+ - _EmissionScrollingCurve1: {instanceID: 0}
+ - _FlipbookTexArray: {instanceID: 0}
+ - _FlipbookMask: {instanceID: 0}
+ - _DissolveEdgeGradient: {instanceID: 0}
+ - _DissolveToTexture: {instanceID: 0}
+ - _DissolveNoiseTexture: {instanceID: 0}
+ - _DissolveDetailNoise: {instanceID: 0}
+ - _DissolveMask: {instanceID: 0}
+ - _PanosphereTexture: {instanceID: 0}
+ - _PanoMapTexture: {instanceID: 0}
+ - _PanoCubeMap: {instanceID: 0}
+ - _GlitterColorMap: {instanceID: 0}
+ - _GlitterMask: {instanceID: 0}
+ - _TextGlyphs: {instanceID: 0}
+ - _MirrorTexture: {instanceID: 0}
+ - _MainFadeTexture: {instanceID: 0}
+ - _DistortionFlowTexture: {instanceID: 0}
+ - _DistortionFlowTexture1: {instanceID: 0}
+ - _VideoPixelTexture: {instanceID: 0}
+ - _VideoMaskTexture: {instanceID: 0}
+ - _VideoDebugTexture: {instanceID: 0}
+ - _VideoGameboyRamp: {instanceID: 0}
+ - _BulgeMask: {instanceID: 0}
+ - _DepthGradient: {instanceID: 0}
+ - _DepthMask: {instanceID: 0}
+ - _HoloAlphaMap: {instanceID: 0}
+ - _IridescenceRamp: {instanceID: 0}
+ - _IridescenceNormalMap: {instanceID: 0}
+ - _IridescenceMask: {instanceID: 0}
+ - _SpawnInNoise: {instanceID: 0}
+ - _ParallaxHeightMap: {instanceID: 0}
+ - _ParallaxInternalMap: {instanceID: 0}
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPCO.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPCO.shader
new file mode 100644
index 00000000..57970222
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPCO.shader
@@ -0,0 +1,1325 @@
+Shader ".poiyomi/Patreon/Tessellation/Outlines Cutout"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#ff0000ff>❤</color> <color=#000000ff>Poiyomi Pro V6.1</color> <color=#ff0000ff>❤</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+ [HideInInspector] shader_properties_label_file ("PoiLabels", Float) = 0
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ // Main
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _MainTex ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 1)) = 0
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AlphaMaskUV ("UV", Int) = 0
+
+ //Hue Shifting
+ [HideInInspector] m_start_MainHueShift ("Hue Shift", Float) = 0
+ [HideInInspector][ToggleUI]_MainHueShiftToggle ("Toggle Hueshift", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Replace?", Float) = 1
+ _MainHueShift ("Hue Shift", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Shift Speed", Float) = 0
+ _MainHueShiftMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainHueShiftMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainHueShiftMaskUV ("UV", Int) = 0
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ // RGB Masking
+ [HideInInspector] m_start_RGBMask ("RGB Color Masking", Float) = 0
+ [HideInInspector][Toggle(FXAA)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ _RGBMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBMaskPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color", Color) = (1, 1, 1, 1)
+ _RedTexure ("R Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBRedPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBRed_UV ("UV", int) = 0
+ _GreenColor ("G Color", Color) = (1, 1, 1, 1)
+ _GreenTexture ("G Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBGreenPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBGreen_UV ("UV", int) = 0
+ _BlueColor ("B Color", Color) = (1, 1, 1, 1)
+ _BlueTexture ("B Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBBluePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBBlue_UV ("UV", int) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Detail Options
+ [HideInInspector] m_start_DetailOptions ("Details", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture Tint", Color) = (1, 1, 1)
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ //Vertex Manipulations
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map", 2D) = "while" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Division Amount", Float) = 500
+ [HideInInspector] m_end_vertexManipulation ("Vertex Options", Float) = 0
+
+ // Alpha Options
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.01
+ [ToggleUI]_DitheringEnabled ("Enable Dithering", Float) = 1
+ _DitherGradient ("Dither Gradient", Range(0, 1)) = .1
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 0
+ _MainShadowClipMod ("Shadow Clip Mod", Range(-1, 1)) = 0
+ [Enum(Off, 0, On, 1)] _AlphaToMask ("Alpha To Coverage", Float) = 0
+ [ToggleUI]_MainAlphaToCoverage ("Sharpenned A2C--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Float) = 0
+ _MainMipScale ("Mip Level Alpha Scale--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Range(0, 1)) = 0.25
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decal", Float) = 0
+ [HideInInspector][Toggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ _DecalColor ("Color", Color) = (1, 1, 1, 1)
+ _DecalTexture ("Decal", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalTextureUV ("UV", Int) = 0
+ _DecalMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalMaskUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ _DecalBlendAdd ("Add", Range(0, 1)) = 0
+ _DecalBlendMultiply ("Multiply", Range(0, 1)) = 0
+ _DecalBlendReplace ("Replace", Range(0, 1)) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face", Float) = 0
+ [ToggleUI]_BackFaceEnabled ("Enable Back Face Options", Float) = 0
+ _BackFaceTexture ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFacePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ _BackFaceHueShift ("Hue Shift", Range(0, 1)) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingOptions ("Lighting", Float) = 0
+ [HideInInspector] m_start_Lighting ("Light and Shadow", Float) = 0
+ [Toggle(LOD_FADE_CROSSFADE)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Natural, 0, Controlled, 1, Standardish, 2, Math, 3)] _LightingType ("Lighting Type", Int) = 1
+ [ToggleUI]_LightingMonochromatic ("Monochromatic?", Float) = 0
+ _LightingGradientStart ("Gradient Start--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = .5
+ _LightingStartColor ("Light Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ _LightingEndColor ("Shadow Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", 2D) = "white" { }
+ _LightingShadowMask ("Shadow Mask (RGBA)--{reference_properties:[_LightingShadowMaskPan, _LightingShadowMaskUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingShadowMaskUV ("UV", Int) = 0
+ _ShadowStrength ("Shadow Strength--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(0, 1)) = .2
+ _ShadowOffset ("Shadow Offset--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(-1, 1)) = 0
+ _LightingAOTex ("AO Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingAOTexUV ("UV", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 0
+ _LightingMinLightBrightness ("Min Brightness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 0
+ _LightingIndirectContribution ("Indirect Contribution--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = .2
+ _AttenuationMultiplier ("Recieve Casted Shadows?", Range(0, 1)) = 0
+ _LightingDetailShadows ("Detail Shadows--{reference_properties:[_LightingDetailShadowsPan, _LightingDetailShadowsUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingDetailShadowsUV ("UV", Int) = 0
+ _LightingDetailStrength ("Detail Strength--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 1
+ _LightingStandardSmoothness ("Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==2}}", Range(0, 1)) = 0
+
+ // Lighting Beta Options
+ [HideInInspector] m_start_lightingBeta ("Extra Ramps--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Float) = 0
+ _LightingNoIndirectThreshold ("Absent Indirect Threshold", Range(0, 1)) = 0.01
+ _LightingNoIndirectMultiplier ("Absent Indirect Multiplier", Range(0, 1)) = 0.5
+ [ToggleUI]_LightingStandardControlsToon ("Standard Lighting Controls Toon Ramp", Float) = 0
+ [IntRange]_LightingNumRamps ("Num Ramps", Range(1, 3)) = 1
+ [Gradient]_ToonRamp1 ("Lighting Ramp 2", 2D) = "white" { }
+ _LightingShadowStrength1 ("Shadow Strength 2", Range(0, 1)) = 1
+ _ShadowOffset1 ("Shadow Offset 2", Range(-1, 1)) = 0
+ [Gradient]_ToonRamp2 ("Lighting Ramp 3", 2D) = "white" { }
+ _LightingShadowStrength2 ("Shadow Strength 3", Range(0, 1)) = 1
+ _ShadowOffset2 ("Shadow Offset 3", Range(-1, 1)) = 0
+ [HideInInspector] m_end_lightingBeta ("Extra Ramps", Float) = 0
+
+ // point/spot Light Settings
+ [HideInInspector] m_start_lightingAdvanced ("Additive Lighting", Float) = 0
+ [Enum(Standard, 0, Controlled, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End", Range(0, 1)) = .5
+ _LightingAdditivePassthrough ("Point Light Passthrough", Range(0, 1)) = .5
+ _LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_lightingAdvanced ("Additive Lighting", Float) = 0
+ [HideInInspector] m_end_Lighting ("Light and Shadow", Float) = 0
+
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [Toggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSSCale ("Light Strength", Range(0, 1)) = 0.25
+ _SSSPower ("Light Spread", Range(1, 100)) = 5
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting", Float) = 0
+ [Toggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [Enum(vertex, 0, pixel, 1)] _RimLightNormal ("Normal Select", Int) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimMaskUV ("UV", Int) = 0
+
+ // Rim Noise
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_RimWidthNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimWidthNoiseTextureUV ("UV", Int) = 0
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Environmental Rim Lighting
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [Toggle(_MAPPING_6_FRAMES_LAYOUT)]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+
+ // Baked Lighting
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ // Metallics
+ [HideInInspector] m_start_Metallic ("Metallics", Float) = 0
+ [Toggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicTintMap ("Tint Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicTintMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicTintMapUV ("UV", Int) = 0
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicMaskUV ("UV", Int) = 0
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SmoothnessMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SmoothnessMaskUV ("UV", Int) = 0
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_Metallic ("Metallics", Float) = 0
+
+ // Clearcoat
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [Toggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ _ClearCoatCubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearCoatSampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearCoatMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatMaskUV ("UV", Int) = 0
+ _ClearCoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearCoatSmoothnessMap ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatSmoothnessMapUV ("UV", Int) = 0
+ [ToggleUI]_ClearCoatInvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 0
+ [ToggleUI]_ClearCoatForceLighting ("Force Lighting", Float) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap / Sphere Textures", Float) = 0
+ [Toggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MatcapMaskUV ("UV", Int) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_matcap ("Matcap", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ToggleUI]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _Matcap2MaskUV ("UV", Int) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ // Specular
+ [HideInInspector] m_start_specular ("Specular Reflections", Float) = 0
+ [Toggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal ("Normal Select", Int) = 1
+ _SpecularAttenuation ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType==3}}}", Range(0, 1)) = 1
+ [Gradient]_SpecularMap ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMapUV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMaskUV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ // Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _Spec1Offset ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMapPan, _AnisoTangentMapUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMapUV ("UV", Int) = 0
+ //toon aniso
+ _SpecularToonStart ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicroPan, _SpecularAnisoJitterMicroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacroPan, _SpecularAnisoJitterMacroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMacroUV ("UV", Int) = 0
+ // Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular ("Specular Reflections", Float) = 0
+
+ // Second Specular
+ [HideInInspector] m_start_specular1 ("Specular Reflections 2", Float) = 0
+ [ToggleUI]_EnableSpecular1 ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType1 ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal1 ("Normal Select", Int) = 1
+ _SpecularAttenuation1 ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint1 ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic1 ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness1 ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==3}}}", Range(-2, 1)) = .75
+ _SpecularMap1 ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMap1UV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness1 ("Invert Smoothness", Float) = 0
+ _SpecularMask1 ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMask1UV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom1 ("Smoothness From", Int) = 1
+ // Second Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent1 ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Int) = 0
+ _AnisoSpec1Alpha1 ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha1 ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _Spec1Offset1 ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness1 ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap1 ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Float) = 0
+ _AnisoTangentMap1 ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMap1Pan, _AnisoTangentMap1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMap1UV ("UV", Int) = 0
+ // Second toon aniso
+ _SpecularToonStart1 ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd1 ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor1 ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored1("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro1 ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicro1Pan, _SpecularAnisoJitterMicro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier1 ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicro1UV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro1 ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacro1Pan, _SpecularAnisoJitterMacro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier1 ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMacro1UV ("UV", Int) = 0
+ // Second Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter1 ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular1 ("Specular Reflections", Float) = 0
+
+ // Outline Options
+ [HideInInspector] m_outlineOptions ("Outlines", Float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ [ToggleUI]_OutlineFixedSize ("Fixed Size?", Float) = 0
+ [ToggleUI]_OutlineUseVertexColors ("V Color as Normal", Float) = 0
+ [ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color", Color) = (1, 1, 1, 1)
+ _OutlineTintMix ("Tint Mix", Range(0, 1)) = 0
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _OutlineTexture ("Outline Texture", 2D) = "white" { }
+ _OutlineMask ("Outline Mask", 2D) = "white" { }
+ _OutlineTexturePan ("Texture XY | Mask ZW Pan", Vector) = (0, 0, 0, 0)
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ _OutlineRimLightBlend ("Rim Light Blend", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY", Vector) = (1, 0, 0, 0)
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ [Vector2]_OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ // Fist Emission
+ [HideInInspector] m_Special_Effects ("Special Effects", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission / Glow", Float) = 0
+ [Toggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMapUV ("UV", Int) = 0
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMaskUV ("UV", Int) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0
+
+ // Center out emission
+ [HideInInspector] m_start_CenterOutEmission ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission ("inward out emission", Float) = 0
+
+ // Glow in the dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ // Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ _EmissionScrollingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emissionOptions ("Emission / Glow", Float) = 0
+
+ // Second Enission
+ [HideInInspector] m_start_emission1Options ("Emission / Glow 2 (Requires Emission 1 Enabled)", Float) = 0
+ [ToggleUI]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap1 ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMap1UV ("UV", Int) = 0
+ _EmissionMask1 ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMask1UV ("UV", Int) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled1 ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0
+
+ // Second Center Out Enission
+ [HideInInspector] m_start_CenterOutEmission1 ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled1 ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission1 ("inward out emission", Float) = 0
+
+ // Second Glow In The Dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission1 ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Second Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max1 ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+
+ // Scrolling Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions1 ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission1 ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction1 ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval", Float) = 20
+ _EmissionScrollingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmission1Options ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emission1Options ("Emission / Glow 2", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook", Float) = 0
+ [Toggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookTexArrayUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookMaskUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Int) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+
+ // Flipbook Manual Control
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve", Float) = 0
+ [Toggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolved Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Noise", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Detail Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_dissolveMasking ("Effect Masking", Float) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmissionSide ("Emission 1", Int) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmission1Side ("Emission 2", Int) = 0
+ [HideInInspector] m_end_dissolveMasking ("Effect Masking", Float) = 0
+
+ // Point to Point Dissolve
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Panosphere
+ [HideInInspector] m_start_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [Toggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ [ToggleUI]_PanoInfiniteStereoToggle ("Infinite Stereo", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_PanoMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _PanoMaskUV ("UV", Int) = 0
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+ [HideInInspector] m_end_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle", Float) = 0
+ [Toggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ //[Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Type", Int) = 0
+ [HDR]_GlitterColor ("Color", Color) = (1, 1, 1)
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Wobble Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias", Range(0, 1)) = .8
+
+ // Glitter Random Colors
+ [HideInInspector] m_start_glitterRandom ("Random Colors", Float) = 0
+ [ToggleUI]_GlitterRandomColors ("Enable", Float) = 0
+ [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1)
+ [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1)
+ [HideInInspector] m_end_glitterRandom ("Random Colors", Float) = 0
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("MSDF Text Overlay", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [Toggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS", Float) = 0
+ [ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color", Color) = (1, 1, 1, 1)
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextFPS ("FPS", Float) = 0
+
+ // POSITION
+ [HideInInspector] m_start_TextPosition ("Position", Float) = 0
+ [ToggleUI]_TextPositionEnabled ("Position Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color", Color) = (1, 0, 1, 1)
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextPosition ("Position", Float) = 0
+
+ // INSTANCE TIME
+ [HideInInspector] m_start_TextInstanceTime ("Instance Time", Float) = 0
+ [ToggleUI]_TextTimeEnabled ("Time Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color", Color) = (1, 0, 1, 1)
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror", Float) = 0
+ [Toggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MirrorTextureUV ("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ // Distance Fade
+ [HideInInspector] m_start_distanceFade ("Distance Fade", Float) = 0
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainFadeTexture ("Fade Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainFadeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainFadeTextureUV ("UV", Int) = 0
+ [Vector2]_MainDistanceFade ("Distance Fade X to Y", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_distanceFade ("Distance Fade", Float) = 0
+
+ // Angular Fade
+ [HideInInspector] m_start_angularFade ("Angular Fade", Float) = 0
+ [Toggle(_SUNDISK_NONE)]_EnableRandom ("Enable Angular Fade", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_angularFade ("Angular Fade", Float) = 0
+
+ // UV Distortion
+ [HideInInspector] m_start_distortionFlow ("UV Distortion", Float) = 0
+ [Toggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ _DistortionFlowTexture ("Distortion Texture 1", 2D) = "black" { }
+ _DistortionFlowTexture1 ("Distortion Texture 2", 2D) = "black" { }
+ _DistortionStrength ("Strength1", Float) = 0.5
+ _DistortionStrength1 ("Strength2", Float) = 0.5
+ [Vector2]_DistortionSpeed ("Speed1", Vector) = (0.5, 0.5, 0, 0)
+ [Vector2]_DistortionSpeed1 ("Speed2", Vector) = (0.5, 0.5, 0, 0)
+ [HideInInspector] m_end_distortionFlow ("UV Distortion", Float) = 0
+
+ // Start Patreon
+ [HideInInspector] m_Patreon ("Patreon", Float) = 0
+ [HideInInspector] m_start_Video ("Video", Float) = 0
+ [Toggle(BLOOM)] _EnableVideo ("Enable Video", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VideoUVNumber ("Screen UV#", Int) = 0
+ [Enum(LCD, 0, TN, 1, CRT, 2, OLED, 3, Gameboy, 4, Projector, 5)] _VideoType ("Screen Type", Int) = 3
+ _VideoBacklight ("Brightness", Range(0, 100)) = 1
+ _VideoPixelTexture ("Pixel Texture", 2D) = "white" { }
+ [Vector2]_VideoResolution ("Resolution", Vector) = (1280, 720, 0)
+ _VideoMaskTexture ("Mask", 2D) = "white" { }
+ [Vector2]_VideoMaskPanning ("Mask Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_VideoSettings ("Video Texture Settings", Float) = 0
+ [ToggleUI]_VideoEnableVideoPlayer ("Enable Video Player", Float) = 0
+ [ToggleUI]_VideoPixelateToResolution ("Pixelate To Resolution", Float) = 0
+ [ToggleUI]_VideoRepeatVideoTexture ("Clamp To UV", Float) = 0
+ [Vector2]_VideoPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_VideoTiling ("Tiling", Vector) = (1, 1, 0, 0)
+ [Vector2]_VideoOffset ("Offset", Vector) = (0, 0, 0, 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_VideoDebug ("Video Debug", Float) = 0
+ [ToggleUI]_VideoEnableDebug ("Enable Debug", Float) = 0
+ _VideoDebugTexture ("Video Debug Tex", 2D) = "white" { }
+ [HideInInspector] m_end_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_start_CRT ("CRT Options", 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", Float) = 0
+ [Gradient]_VideoGameboyRamp ("Color Ramp", 2D) = "white" { }
+ [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Video ("Video", Float) = 0
+
+ [HideInInspector] m_start_TouchOptions ("Touch FX", Float) = 0
+ [HideInInspector] m_start_Bulge ("Bulge", Float) = 0
+ [Toggle(BLOOM_LOW)] _EnableBulge ("Bulge", Float) = 0
+ _BulgeMask ("Bulge Mask", 2D) = "white" { }
+ _BuldgeFadeLength ("Touch Distance", Float) = 0.02
+ _BuldgeHeight ("Bulge Height", Range(-0.2, 0.2)) = 0.02
+ [HideInInspector] m_end_Bulge ("Bulge", Float) = 0
+
+ [HideInInspector] m_start_TouchGlow ("Touch Color", Float) = 0
+ [Toggle(GRAIN)]_EnableTouchGlow ("Enable Touch Glow", Float) = 0
+ _DepthGlowColor ("Depth Glow Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DepthGradient ("Depth Gradient", 2D) = "white" { }
+ _DepthMask ("Depth Mask", 2D) = "white" { }
+ _DepthGlowEmission ("Depth Glow Emission", Float) = 3
+ _FadeLength ("Fade Length", Float) = 0.02
+ _DepthAlphaMin ("Alpha Min", Range(0, 1)) = 1
+ _DepthAlphaMax ("Alpha Max", Range(0, 1)) = 1
+ [HideInInspector] m_end_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchOptions ("Touch FX", Float) = 0
+
+ [HideInInspector] m_start_Hologram ("Hologram Alpha", Float) = 0
+ [Toggle(DEPTH_OF_FIELD)]_EnableHolo ("Enable Hologram Alpha", Float) = 0
+ [Curve]_HoloAlphaMap ("Alpha Map", 2D) = "white" { }
+ [Enum(World Space, 0, Local Space, 1, UV, 2)]_HoloCoordinateSpace ("Coordinate Space", Int) = 0
+ _HoloDirection ("Scroll Direction", Vector) = (0, 1, 0)
+ _HoloLineDensity ("Line Density", Float) = 10
+ _HoloScrollSpeed ("Scroll Speed", Float) = 1
+ [HideInInspector] m_start_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ _HoloFresnelAlpha ("Intensity", Range(0, 1)) = 0
+ _HoloRimSharpness ("Sharpness", Range(0, 1)) = .5
+ _HoloRimWidth ("Width", Range(0, 1)) = .5
+ [HideInInspector] m_end_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_Hologram ("Hologram Alpha", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence", Float) = 0
+ [Toggle(BLOOM_LENS_DIRT)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp", 2D) = "white" { }
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map", 2D) = "bump" { }
+ _IridescenceMask ("Mask", 2D) = "white" { }
+ _IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceNormalUV ("Normal UV", Int) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceMaskUV ("Mask UV", Int) = 0
+ [Enum(vertex, 0, pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Enum(Run Early, 0, Run Late, 1)] _IridescenceTime ("When To Run", Int) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ [HideInInspector] m_start_VertexGlitch ("Vertex Glitching", Float) = 0
+ [ToggleUI]_EnableVertexGlitch ("Enable Vertex Glitching", Float) = 0
+ _VertexGlitchFrequency ("Glitch Interval", Float) = 0
+ _VertexGlitchThreshold ("Glitch Threshold", Range(0, 1)) = 1
+ _VertexGlitchStrength ("Glitch Strength", Range(0, 10)) = 1
+ [HideInInspector] m_end_VertexGlitch ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_Spawns ("Spawns", Float) = 0
+ [HideInInspector] m_start_ScifiSpawnIn ("Sci Fi", Float) = 0
+ [ToggleUI]_EnableScifiSpawnIn ("Enable Sci Fi Spawn", Float) = 0
+ _SpawnInNoise ("Spawn Noise", 2D) = "black" { }
+ _SpawnInNoiseIntensity ("Noise Intensity", Range(0, 1)) = .35
+ _SpawnInAlpha ("Spawn Alpha", Range(0, 1)) = 0
+ [Vector3]_SpawnInGradientStart ("Gradient Start", Vector) = (0, 2, 0)
+ [Vector3]_SpawnInGradientFinish ("Gradient End", Vector) = (0, -2, 0)
+ [HDR]_SpawnInEmissionColor ("Emission Color", Color) = (1, 1, 1)
+ _SpawnInEmissionOffset ("Emission Width", Range(0, 1)) = .1
+ _SpawnInVertOffset ("Vertex Offset Speed", Float) = 10
+ _SpawnInVertOffsetOffset ("vert width", Range(0, 1)) = .1
+ [HideInInspector] m_end_SciFiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_Spawns ("Spawns", Float) = 0
+
+ [HideInInspector] m_start_Tessellation ("Tessellation", Float) = 0
+ _TessellationPhongStrength ("Phong Strength", Range(0, 1)) = 0.5
+ _TessellationEdgeLength ("Edge Length", Range(2, 50)) = 5
+ _TessellationExtrusionAmount ("Extrusion", Range(-0.005, 0.005)) = 0.0
+ //[Toggle(_FADING_ON)]_EnableUniformTessellation ("Uniform Tessellation", Float) = 0
+ //_TessellationUniform ("Uniform", Range(1,64)) = 5
+ [HideInInspector] m_end_Tessellation ("Tessellation", Float) = 0
+
+ // Voronoi
+ [HideInInspector] m_start_Voronoi ("Vertex Glitching", Float) = 0
+ [Enum(2D (Fast), 0, 3D (Fast with color bugs), 1, 3D (slow but no bugs), 2)] _VoronoiType ("Space", Int) = 1
+ [Enum(Local, 0, World, 1, UV, 2)] _VoronoiSpace ("Space", Int) = 0
+ [Enum(Color and Emission, 0, Just Emission, 1)] _VoronoiBlend ("Blend", Int) = 0
+ [Toggle(CHROMATIC_ABERRATION)]_EnableVoronoi ("Enable Voronoi", Float) = 0
+ _VoronoiMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_VoronoiMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiMaskUV ("UV", Int) = 0
+ _VoronoiNoise ("Edge Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_VoronoiNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiNoiseUV ("UV", Int) = 0
+ _VoronoiNoiseIntensity ("Noise Intensity", Range(0,1)) = .1
+ _VoronoiColor0 ("Color 0", Color) = (0, 0, 0, 1)
+ _VoronoiEmission0 ("Emission 0", Range(0, 20)) = 0
+ _VoronoiColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ _VoronoiEmission1 ("Emission 1", Range(0, 20)) = 0
+ [Vector2]_VoronoiGradient ("Gradient", Vector) = (.04, .05, 0, 0)
+ _VoronoiScale ("Scale", Float) = 5
+ [Vector3]_VoronoiSpeed ("Speed", Vector) = (3, 3, 3)
+ [HideInInspector] m_start_voronoiRandom("Voronoi Random Cell Color", Float) = 0
+ [ToggleUI]_VoronoiEnableRandomCellColor ("Rando Cell Col", Float) = 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_end_Voronoi ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_BlackLight ("Black Light Mask", Float) = 0
+ [HideInInspector][Toggle(_SPECULARHIGHLIGHTS_OFF)]_BlackLightMaskEnabled ("Black Light Mask Enabled", Float) = 0
+ _BlackLightMaskKeys ("Mask Keys", Vector) = (2, 3, 4, 5)
+ _BlackLightMaskStart ("Gradient Start", Vector) = (0, 0, 0, 0)
+ _BlackLightMaskEnd ("Gradient End", Vector) = (1, 1, 1, 1)
+ [ToggleUI]_BlackLightMaskDebug ("Visualize", Float) = 0
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMetallic ("Metallic", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskClearCoat ("Clear Coat", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap ("Matcap 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap2 ("Matcap 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission ("Emission 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission2 ("Emission 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskFlipbook ("Flipbook", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskDissolve ("Dissolve", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskPanosphere ("Panosphere", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskGlitter ("Glitter", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskIridescence ("Iridescence", Int) = 4
+ [HideInInspector] m_end_BlackLight ("Black Light", Float) = 0
+ // End Patreon
+
+ // Parallax Mapping
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [Toggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ [Vector2]_ParallaxHeightMapPan ("Pan", Vector) = (0, 0, 0, 0)
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ParallaxUV ("Parallax UV", Int) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxHeightMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxHeightMapMaskUV ("UV", Int) = 0
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxInternalMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxInternalMapMaskUV ("UV", Int) = 0
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+ [HideInInspector] m_start_parallaxAdvanced ("Advanced", Float) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxAdvanced ("Advanced", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ _ZBias ("ZBias", Float) = 0.0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Outline Stencils
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _OutlineStencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _OutlineStencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ // Debug Options
+ [HideInInspector] m_start_debugOptions ("Debug", Float) = 0
+ [HideInInspector][Toggle(_COLOROVERLAY_ON)]_DebugEnabled ("Display Debug Info", Float) = 0
+ _VertexUnwrap ("Unwrap", Range(0, 1)) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ [HideInInspector] m_end_debugOptions ("Debug", Float) = 0
+ }
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "RenderType" = "TransparentCutout" "Queue" = "AlphaTest+10" }
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_BASE_PASS
+ #define CUTOUT
+ #define TESSELATION
+ // Base Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // patreon Base
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // Uniform Tessellation
+ #pragma shader_feature _FADING_ON
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Touch Color
+ #pragma shader_feature GRAIN
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex poiTessellationVert
+ #pragma hull poiHull
+ #pragma domain poiDomain
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_ADD_PASS
+ #define CUTOUT
+ #define TESSELATION
+ // Add Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // Uniform Tessellation
+ #pragma shader_feature _FADING_ON
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex poiTessellationVert
+ #pragma hull poiHull
+ #pragma domain poiDomain
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "Outline"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ ZTest [_ZTest]
+ AlphaToMask [_AlphaToMask]
+ Offset [_ZBias], [_ZBias]
+ Cull [_OutlineCull]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_BASE_PASS
+ #define OUTLINE
+ #define TESSELATION
+ // Uniform Tessellation
+ #pragma shader_feature _FADING_ON
+
+ #pragma multi_compile_fwdbase
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma multi_compile_instancing
+ #pragma vertex poiTessellationVert
+ #pragma hull poiHull
+ #pragma domain poiDomain
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPassOutline.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define CUTOUT
+ #define POI_SHADOW
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/CGI_PoiPassShadow.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+ Cull Off
+ CGPROGRAM
+
+ #define POI_META_PASS
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ }
+ Fallback "Toon/Lit Cutout (Double)"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPCO.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPCO.shader.meta
new file mode 100644
index 00000000..4f6ff578
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Cutout_PPCO.shader.meta
@@ -0,0 +1,86 @@
+fileFormatVersion: 2
+guid: fff61915d8417f643a0d616e020eb370
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {fileID: 2800000, guid: a6d6984545cde4a4f9317b17d6dca225, type: 3}
+ - _BumpMap: {instanceID: 0}
+ - _AlphaMask: {instanceID: 0}
+ - _RGBMask: {instanceID: 0}
+ - _RedTexure: {instanceID: 0}
+ - _GreenTexture: {instanceID: 0}
+ - _BlueTexture: {instanceID: 0}
+ - _DetailMask: {instanceID: 0}
+ - _DetailTex: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _VertexManipulationHeightMask: {instanceID: 0}
+ - _BackFaceTexture: {instanceID: 0}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ - _LightingShadowMask: {instanceID: 0}
+ - _AOMap: {instanceID: 0}
+ - _ToonRamp1: {instanceID: 0}
+ - _ToonRamp2: {instanceID: 0}
+ - _SSSThicknessMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ - _RimMask: {instanceID: 0}
+ - _RimWidthNoiseTexture: {instanceID: 0}
+ - _RimEnviroMask: {instanceID: 0}
+ - _CubeMap: {instanceID: 0}
+ - _MetallicMask: {instanceID: 0}
+ - _SmoothnessMask: {instanceID: 0}
+ - _ClearCoatCubeMap: {instanceID: 0}
+ - _ClearCoatMask: {instanceID: 0}
+ - _ClearCoatSmoothnessMask: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMask: {instanceID: 0}
+ - _Matcap2: {instanceID: 0}
+ - _Matcap2Mask: {instanceID: 0}
+ - _SpecularMap: {instanceID: 0}
+ - _SpecularMask: {instanceID: 0}
+ - _AnisoTangentMap: {instanceID: 0}
+ - _SpecularMap1: {instanceID: 0}
+ - _SpecularMask1: {instanceID: 0}
+ - _AnisoTangentMap1: {instanceID: 0}
+ - _OutlineTexture: {instanceID: 0}
+ - _OutlineMask: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _EmissionScrollingCurve: {instanceID: 0}
+ - _EmissionMap1: {instanceID: 0}
+ - _EmissionMask1: {instanceID: 0}
+ - _EmissionScrollingCurve1: {instanceID: 0}
+ - _FlipbookTexArray: {instanceID: 0}
+ - _FlipbookMask: {instanceID: 0}
+ - _DissolveEdgeGradient: {instanceID: 0}
+ - _DissolveToTexture: {instanceID: 0}
+ - _DissolveNoiseTexture: {instanceID: 0}
+ - _DissolveDetailNoise: {instanceID: 0}
+ - _DissolveMask: {instanceID: 0}
+ - _PanosphereTexture: {instanceID: 0}
+ - _PanoMapTexture: {instanceID: 0}
+ - _PanoCubeMap: {instanceID: 0}
+ - _GlitterColorMap: {instanceID: 0}
+ - _GlitterMask: {instanceID: 0}
+ - _TextGlyphs: {instanceID: 0}
+ - _MirrorTexture: {instanceID: 0}
+ - _MainFadeTexture: {instanceID: 0}
+ - _DistortionFlowTexture: {instanceID: 0}
+ - _DistortionFlowTexture1: {instanceID: 0}
+ - _VideoPixelTexture: {instanceID: 0}
+ - _VideoMaskTexture: {instanceID: 0}
+ - _VideoDebugTexture: {instanceID: 0}
+ - _VideoGameboyRamp: {instanceID: 0}
+ - _BulgeMask: {instanceID: 0}
+ - _DepthGradient: {instanceID: 0}
+ - _DepthMask: {instanceID: 0}
+ - _HoloAlphaMap: {instanceID: 0}
+ - _IridescenceRamp: {instanceID: 0}
+ - _IridescenceNormalMap: {instanceID: 0}
+ - _IridescenceMask: {instanceID: 0}
+ - _SpawnInNoise: {instanceID: 0}
+ - _ParallaxHeightMap: {instanceID: 0}
+ - _ParallaxInternalMap: {instanceID: 0}
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Transparent_PPT.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Transparent_PPT.shader
new file mode 100644
index 00000000..3f628e42
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Transparent_PPT.shader
@@ -0,0 +1,1245 @@
+Shader ".poiyomi/Patreon/Tessellation/Transparent"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#ff0000ff>❤</color> <color=#000000ff>Poiyomi Pro V6.1</color> <color=#ff0000ff>❤</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+ [HideInInspector] shader_properties_label_file ("PoiLabels", Float) = 0
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ // Main
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _MainTex ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 1)) = 0
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AlphaMaskUV ("UV", Int) = 0
+
+ //Hue Shifting
+ [HideInInspector] m_start_MainHueShift ("Hue Shift", Float) = 0
+ [HideInInspector][ToggleUI]_MainHueShiftToggle ("Toggle Hueshift", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Replace?", Float) = 1
+ _MainHueShift ("Hue Shift", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Shift Speed", Float) = 0
+ _MainHueShiftMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainHueShiftMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainHueShiftMaskUV ("UV", Int) = 0
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ // RGB Masking
+ [HideInInspector] m_start_RGBMask ("RGB Color Masking", Float) = 0
+ [HideInInspector][Toggle(FXAA)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ _RGBMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBMaskPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color", Color) = (1, 1, 1, 1)
+ _RedTexure ("R Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBRedPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBRed_UV ("UV", int) = 0
+ _GreenColor ("G Color", Color) = (1, 1, 1, 1)
+ _GreenTexture ("G Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBGreenPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBGreen_UV ("UV", int) = 0
+ _BlueColor ("B Color", Color) = (1, 1, 1, 1)
+ _BlueTexture ("B Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBBluePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBBlue_UV ("UV", int) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Detail Options
+ [HideInInspector] m_start_DetailOptions ("Details", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture Tint", Color) = (1, 1, 1)
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ //Vertex Manipulations
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map", 2D) = "while" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Division Amount", Float) = 500
+ [HideInInspector] m_end_vertexManipulation ("Vertex Options", Float) = 0
+
+ // Alpha Options
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.01
+ [ToggleUI]_DitheringEnabled ("Enable Dithering", Float) = 1
+ _DitherGradient ("Dither Gradient", Range(0, 1)) = .1
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 0
+ _MainShadowClipMod ("Shadow Clip Mod", Range(-1, 1)) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decal", Float) = 0
+ [HideInInspector][Toggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ _DecalColor ("Color", Color) = (1, 1, 1, 1)
+ _DecalTexture ("Decal", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalTextureUV ("UV", Int) = 0
+ _DecalMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalMaskUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ _DecalBlendAdd ("Add", Range(0, 1)) = 0
+ _DecalBlendMultiply ("Multiply", Range(0, 1)) = 0
+ _DecalBlendReplace ("Replace", Range(0, 1)) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face", Float) = 0
+ [ToggleUI]_BackFaceEnabled ("Enable Back Face Options", Float) = 0
+ _BackFaceTexture ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFacePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ _BackFaceHueShift ("Hue Shift", Range(0, 1)) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingOptions ("Lighting", Float) = 0
+ [HideInInspector] m_start_Lighting ("Light and Shadow", Float) = 0
+ [Toggle(LOD_FADE_CROSSFADE)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Natural, 0, Controlled, 1, Standardish, 2, Math, 3)] _LightingType ("Lighting Type", Int) = 1
+ [ToggleUI]_LightingMonochromatic ("Monochromatic?", Float) = 0
+ _LightingGradientStart ("Gradient Start--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = .5
+ _LightingStartColor ("Light Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ _LightingEndColor ("Shadow Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", 2D) = "white" { }
+ _LightingShadowMask ("Shadow Mask (RGBA)--{reference_properties:[_LightingShadowMaskPan, _LightingShadowMaskUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingShadowMaskUV ("UV", Int) = 0
+ _ShadowStrength ("Shadow Strength--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(0, 1)) = .2
+ _ShadowOffset ("Shadow Offset--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(-1, 1)) = 0
+ _LightingAOTex ("AO Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingAOTexUV ("UV", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 0
+ _LightingMinLightBrightness ("Min Brightness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 0
+ _LightingIndirectContribution ("Indirect Contribution--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = .2
+ _AttenuationMultiplier ("Recieve Casted Shadows?", Range(0, 1)) = 0
+ _LightingDetailShadows ("Detail Shadows--{reference_properties:[_LightingDetailShadowsPan, _LightingDetailShadowsUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingDetailShadowsUV ("UV", Int) = 0
+ _LightingDetailStrength ("Detail Strength--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 1
+ _LightingStandardSmoothness ("Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==2}}", Range(0, 1)) = 0
+
+ // Lighting Beta Options
+ [HideInInspector] m_start_lightingBeta ("Extra Ramps--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Float) = 0
+ _LightingNoIndirectThreshold ("Absent Indirect Threshold", Range(0, 1)) = 0.01
+ _LightingNoIndirectMultiplier ("Absent Indirect Multiplier", Range(0, 1)) = 0.5
+ [ToggleUI]_LightingStandardControlsToon ("Standard Lighting Controls Toon Ramp", Float) = 0
+ [IntRange]_LightingNumRamps ("Num Ramps", Range(1, 3)) = 1
+ [Gradient]_ToonRamp1 ("Lighting Ramp 2", 2D) = "white" { }
+ _LightingShadowStrength1 ("Shadow Strength 2", Range(0, 1)) = 1
+ _ShadowOffset1 ("Shadow Offset 2", Range(-1, 1)) = 0
+ [Gradient]_ToonRamp2 ("Lighting Ramp 3", 2D) = "white" { }
+ _LightingShadowStrength2 ("Shadow Strength 3", Range(0, 1)) = 1
+ _ShadowOffset2 ("Shadow Offset 3", Range(-1, 1)) = 0
+ [HideInInspector] m_end_lightingBeta ("Extra Ramps", Float) = 0
+
+ // point/spot Light Settings
+ [HideInInspector] m_start_lightingAdvanced ("Additive Lighting", Float) = 0
+ [Enum(Standard, 0, Controlled, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End", Range(0, 1)) = .5
+ _LightingAdditivePassthrough ("Point Light Passthrough", Range(0, 1)) = .5
+ _LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_lightingAdvanced ("Additive Lighting", Float) = 0
+ [HideInInspector] m_end_Lighting ("Light and Shadow", Float) = 0
+
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [Toggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSSCale ("Light Strength", Range(0, 1)) = 0.25
+ _SSSPower ("Light Spread", Range(1, 100)) = 5
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting", Float) = 0
+ [Toggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [Enum(vertex, 0, pixel, 1)] _RimLightNormal ("Normal Select", Int) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimMaskUV ("UV", Int) = 0
+
+ // Rim Noise
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_RimWidthNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimWidthNoiseTextureUV ("UV", Int) = 0
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Environmental Rim Lighting
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [Toggle(_MAPPING_6_FRAMES_LAYOUT)]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+
+ // Baked Lighting
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ // Metallics
+ [HideInInspector] m_start_Metallic ("Metallics", Float) = 0
+ [Toggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicTintMap ("Tint Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicTintMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicTintMapUV ("UV", Int) = 0
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicMaskUV ("UV", Int) = 0
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SmoothnessMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SmoothnessMaskUV ("UV", Int) = 0
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_Metallic ("Metallics", Float) = 0
+
+ // Clearcoat
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [Toggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ _ClearCoatCubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearCoatSampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearCoatMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatMaskUV ("UV", Int) = 0
+ _ClearCoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearCoatSmoothnessMap ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatSmoothnessMapUV ("UV", Int) = 0
+ [ToggleUI]_ClearCoatInvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 0
+ [ToggleUI]_ClearCoatForceLighting ("Force Lighting", Float) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap / Sphere Textures", Float) = 0
+ [Toggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MatcapMaskUV ("UV", Int) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_matcap ("Matcap", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ToggleUI]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _Matcap2MaskUV ("UV", Int) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ // Specular
+ [HideInInspector] m_start_specular ("Specular Reflections", Float) = 0
+ [Toggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal ("Normal Select", Int) = 1
+ _SpecularAttenuation ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType==3}}}", Range(0, 1)) = 1
+ [Gradient]_SpecularMap ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMapUV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMaskUV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ // Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _Spec1Offset ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMapPan, _AnisoTangentMapUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMapUV ("UV", Int) = 0
+ //toon aniso
+ _SpecularToonStart ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicroPan, _SpecularAnisoJitterMicroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacroPan, _SpecularAnisoJitterMacroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMacroUV ("UV", Int) = 0
+ // Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular ("Specular Reflections", Float) = 0
+
+ // Second Specular
+ [HideInInspector] m_start_specular1 ("Specular Reflections 2", Float) = 0
+ [ToggleUI]_EnableSpecular1 ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType1 ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal1 ("Normal Select", Int) = 1
+ _SpecularAttenuation1 ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint1 ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic1 ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness1 ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==3}}}", Range(-2, 1)) = .75
+ _SpecularMap1 ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMap1UV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness1 ("Invert Smoothness", Float) = 0
+ _SpecularMask1 ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMask1UV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom1 ("Smoothness From", Int) = 1
+ // Second Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent1 ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Int) = 0
+ _AnisoSpec1Alpha1 ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha1 ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _Spec1Offset1 ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness1 ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap1 ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Float) = 0
+ _AnisoTangentMap1 ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMap1Pan, _AnisoTangentMap1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMap1UV ("UV", Int) = 0
+ // Second toon aniso
+ _SpecularToonStart1 ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd1 ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor1 ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored1("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro1 ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicro1Pan, _SpecularAnisoJitterMicro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier1 ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicro1UV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro1 ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacro1Pan, _SpecularAnisoJitterMacro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier1 ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMacro1UV ("UV", Int) = 0
+ // Second Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter1 ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular1 ("Specular Reflections", Float) = 0
+
+ // Fist Emission
+ [HideInInspector] m_Special_Effects ("Special Effects", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission / Glow", Float) = 0
+ [Toggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMapUV ("UV", Int) = 0
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMaskUV ("UV", Int) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0
+
+ // Center out emission
+ [HideInInspector] m_start_CenterOutEmission ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission ("inward out emission", Float) = 0
+
+ // Glow in the dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ // Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ _EmissionScrollingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emissionOptions ("Emission / Glow", Float) = 0
+
+ // Second Enission
+ [HideInInspector] m_start_emission1Options ("Emission / Glow 2 (Requires Emission 1 Enabled)", Float) = 0
+ [ToggleUI]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap1 ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMap1UV ("UV", Int) = 0
+ _EmissionMask1 ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMask1UV ("UV", Int) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled1 ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0
+
+ // Second Center Out Enission
+ [HideInInspector] m_start_CenterOutEmission1 ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled1 ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission1 ("inward out emission", Float) = 0
+
+ // Second Glow In The Dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission1 ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Second Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max1 ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+
+ // Scrolling Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions1 ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission1 ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction1 ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval", Float) = 20
+ _EmissionScrollingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmission1Options ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emission1Options ("Emission / Glow 2", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook", Float) = 0
+ [Toggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookTexArrayUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookMaskUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Int) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+
+ // Flipbook Manual Control
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve", Float) = 0
+ [Toggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolved Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Noise", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Detail Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_dissolveMasking ("Effect Masking", Float) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmissionSide ("Emission 1", Int) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmission1Side ("Emission 2", Int) = 0
+ [HideInInspector] m_end_dissolveMasking ("Effect Masking", Float) = 0
+
+ // Point to Point Dissolve
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Panosphere
+ [HideInInspector] m_start_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [Toggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ [ToggleUI]_PanoInfiniteStereoToggle ("Infinite Stereo", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_PanoMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _PanoMaskUV ("UV", Int) = 0
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+ [HideInInspector] m_end_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle", Float) = 0
+ [Toggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ //[Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Type", Int) = 0
+ [HDR]_GlitterColor ("Color", Color) = (1, 1, 1)
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Wobble Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias", Range(0, 1)) = .8
+
+ // Glitter Random Colors
+ [HideInInspector] m_start_glitterRandom ("Random Colors", Float) = 0
+ [ToggleUI]_GlitterRandomColors ("Enable", Float) = 0
+ [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1)
+ [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1)
+ [HideInInspector] m_end_glitterRandom ("Random Colors", Float) = 0
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("MSDF Text Overlay", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [Toggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS", Float) = 0
+ [ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color", Color) = (1, 1, 1, 1)
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextFPS ("FPS", Float) = 0
+
+ // POSITION
+ [HideInInspector] m_start_TextPosition ("Position", Float) = 0
+ [ToggleUI]_TextPositionEnabled ("Position Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color", Color) = (1, 0, 1, 1)
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextPosition ("Position", Float) = 0
+
+ // INSTANCE TIME
+ [HideInInspector] m_start_TextInstanceTime ("Instance Time", Float) = 0
+ [ToggleUI]_TextTimeEnabled ("Time Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color", Color) = (1, 0, 1, 1)
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror", Float) = 0
+ [Toggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MirrorTextureUV ("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ // Distance Fade
+ [HideInInspector] m_start_distanceFade ("Distance Fade", Float) = 0
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainFadeTexture ("Fade Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainFadeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainFadeTextureUV ("UV", Int) = 0
+ [Vector2]_MainDistanceFade ("Distance Fade X to Y", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_distanceFade ("Distance Fade", Float) = 0
+
+ // Angular Fade
+ [HideInInspector] m_start_angularFade ("Angular Fade", Float) = 0
+ [Toggle(_SUNDISK_NONE)]_EnableRandom ("Enable Angular Fade", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_angularFade ("Angular Fade", Float) = 0
+
+ // UV Distortion
+ [HideInInspector] m_start_distortionFlow ("UV Distortion", Float) = 0
+ [Toggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ _DistortionFlowTexture ("Distortion Texture 1", 2D) = "black" { }
+ _DistortionFlowTexture1 ("Distortion Texture 2", 2D) = "black" { }
+ _DistortionStrength ("Strength1", Float) = 0.5
+ _DistortionStrength1 ("Strength2", Float) = 0.5
+ [Vector2]_DistortionSpeed ("Speed1", Vector) = (0.5, 0.5, 0, 0)
+ [Vector2]_DistortionSpeed1 ("Speed2", Vector) = (0.5, 0.5, 0, 0)
+ [HideInInspector] m_end_distortionFlow ("UV Distortion", Float) = 0
+
+ // Start Patreon
+ [HideInInspector] m_Patreon ("Patreon", Float) = 0
+ [HideInInspector] m_start_Video ("Video", Float) = 0
+ [Toggle(BLOOM)] _EnableVideo ("Enable Video", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VideoUVNumber ("Screen UV#", Int) = 0
+ [Enum(LCD, 0, TN, 1, CRT, 2, OLED, 3, Gameboy, 4, Projector, 5)] _VideoType ("Screen Type", Int) = 3
+ _VideoBacklight ("Brightness", Range(0, 100)) = 1
+ _VideoPixelTexture ("Pixel Texture", 2D) = "white" { }
+ [Vector2]_VideoResolution ("Resolution", Vector) = (1280, 720, 0)
+ _VideoMaskTexture ("Mask", 2D) = "white" { }
+ [Vector2]_VideoMaskPanning ("Mask Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_VideoSettings ("Video Texture Settings", Float) = 0
+ [ToggleUI]_VideoEnableVideoPlayer ("Enable Video Player", Float) = 0
+ [ToggleUI]_VideoPixelateToResolution ("Pixelate To Resolution", Float) = 0
+ [ToggleUI]_VideoRepeatVideoTexture ("Clamp To UV", Float) = 0
+ [Vector2]_VideoPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_VideoTiling ("Tiling", Vector) = (1, 1, 0, 0)
+ [Vector2]_VideoOffset ("Offset", Vector) = (0, 0, 0, 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_VideoDebug ("Video Debug", Float) = 0
+ [ToggleUI]_VideoEnableDebug ("Enable Debug", Float) = 0
+ _VideoDebugTexture ("Video Debug Tex", 2D) = "white" { }
+ [HideInInspector] m_end_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_start_CRT ("CRT Options", 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", Float) = 0
+ [Gradient]_VideoGameboyRamp ("Color Ramp", 2D) = "white" { }
+ [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Video ("Video", Float) = 0
+
+ [HideInInspector] m_start_TouchOptions ("Touch FX", Float) = 0
+ [HideInInspector] m_start_Bulge ("Bulge", Float) = 0
+ [Toggle(BLOOM_LOW)] _EnableBulge ("Bulge", Float) = 0
+ _BulgeMask ("Bulge Mask", 2D) = "white" { }
+ _BuldgeFadeLength ("Touch Distance", Float) = 0.02
+ _BuldgeHeight ("Bulge Height", Range(-0.2, 0.2)) = 0.02
+ [HideInInspector] m_end_Bulge ("Bulge", Float) = 0
+
+ [HideInInspector] m_start_TouchGlow ("Touch Color", Float) = 0
+ [Toggle(GRAIN)]_EnableTouchGlow ("Enable Touch Glow", Float) = 0
+ _DepthGlowColor ("Depth Glow Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DepthGradient ("Depth Gradient", 2D) = "white" { }
+ _DepthMask ("Depth Mask", 2D) = "white" { }
+ _DepthGlowEmission ("Depth Glow Emission", Float) = 3
+ _FadeLength ("Fade Length", Float) = 0.02
+ _DepthAlphaMin ("Alpha Min", Range(0, 1)) = 1
+ _DepthAlphaMax ("Alpha Max", Range(0, 1)) = 1
+ [HideInInspector] m_end_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchOptions ("Touch FX", Float) = 0
+
+ [HideInInspector] m_start_Hologram ("Hologram Alpha", Float) = 0
+ [Toggle(DEPTH_OF_FIELD)]_EnableHolo ("Enable Hologram Alpha", Float) = 0
+ [Curve]_HoloAlphaMap ("Alpha Map", 2D) = "white" { }
+ [Enum(World Space, 0, Local Space, 1, UV, 2)]_HoloCoordinateSpace ("Coordinate Space", Int) = 0
+ _HoloDirection ("Scroll Direction", Vector) = (0, 1, 0)
+ _HoloLineDensity ("Line Density", Float) = 10
+ _HoloScrollSpeed ("Scroll Speed", Float) = 1
+ [HideInInspector] m_start_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ _HoloFresnelAlpha ("Intensity", Range(0, 1)) = 0
+ _HoloRimSharpness ("Sharpness", Range(0, 1)) = .5
+ _HoloRimWidth ("Width", Range(0, 1)) = .5
+ [HideInInspector] m_end_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_Hologram ("Hologram Alpha", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence", Float) = 0
+ [Toggle(BLOOM_LENS_DIRT)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp", 2D) = "white" { }
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map", 2D) = "bump" { }
+ _IridescenceMask ("Mask", 2D) = "white" { }
+ _IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceNormalUV ("Normal UV", Int) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceMaskUV ("Mask UV", Int) = 0
+ [Enum(vertex, 0, pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Enum(Run Early, 0, Run Late, 1)] _IridescenceTime ("When To Run", Int) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ [HideInInspector] m_start_VertexGlitch ("Vertex Glitching", Float) = 0
+ [ToggleUI]_EnableVertexGlitch ("Enable Vertex Glitching", Float) = 0
+ _VertexGlitchFrequency ("Glitch Interval", Float) = 0
+ _VertexGlitchThreshold ("Glitch Threshold", Range(0, 1)) = 1
+ _VertexGlitchStrength ("Glitch Strength", Range(0, 10)) = 1
+ [HideInInspector] m_end_VertexGlitch ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_Spawns ("Spawns", Float) = 0
+ [HideInInspector] m_start_ScifiSpawnIn ("Sci Fi", Float) = 0
+ [ToggleUI]_EnableScifiSpawnIn ("Enable Sci Fi Spawn", Float) = 0
+ _SpawnInNoise ("Spawn Noise", 2D) = "black" { }
+ _SpawnInNoiseIntensity ("Noise Intensity", Range(0, 1)) = .35
+ _SpawnInAlpha ("Spawn Alpha", Range(0, 1)) = 0
+ [Vector3]_SpawnInGradientStart ("Gradient Start", Vector) = (0, 2, 0)
+ [Vector3]_SpawnInGradientFinish ("Gradient End", Vector) = (0, -2, 0)
+ [HDR]_SpawnInEmissionColor ("Emission Color", Color) = (1, 1, 1)
+ _SpawnInEmissionOffset ("Emission Width", Range(0, 1)) = .1
+ _SpawnInVertOffset ("Vertex Offset Speed", Float) = 10
+ _SpawnInVertOffsetOffset ("vert width", Range(0, 1)) = .1
+ [HideInInspector] m_end_SciFiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_Spawns ("Spawns", Float) = 0
+
+ [HideInInspector] m_start_Tessellation ("Tessellation", Float) = 0
+ _TessellationPhongStrength ("Phong Strength", Range(0, 1)) = 0.5
+ _TessellationEdgeLength ("Edge Length", Range(2, 50)) = 5
+ _TessellationExtrusionAmount ("Extrusion", Range(-0.005, 0.005)) = 0.0
+ //[Toggle(_FADING_ON)]_EnableUniformTessellation ("Uniform Tessellation", Float) = 0
+ //_TessellationUniform ("Uniform", Range(1,64)) = 5
+ [HideInInspector] m_end_Tessellation ("Tessellation", Float) = 0
+
+ // Voronoi
+ [HideInInspector] m_start_Voronoi ("Vertex Glitching", Float) = 0
+ [Enum(2D(Fast), 0, 3D(Fast with color bugs), 1, 3D(slow but no bugs), 2)] _VoronoiType ("Space", Int) = 1
+ [Enum(Local, 0, World, 1, UV, 2)] _VoronoiSpace ("Space", Int) = 0
+ [Enum(Color and Emission, 0, Just Emission, 1)] _VoronoiBlend ("Blend", Int) = 0
+ [Toggle(CHROMATIC_ABERRATION)]_EnableVoronoi ("Enable Voronoi", Float) = 0
+ _VoronoiMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_VoronoiMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiMaskUV ("UV", Int) = 0
+ _VoronoiNoise ("Edge Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_VoronoiNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiNoiseUV ("UV", Int) = 0
+ _VoronoiNoiseIntensity ("Noise Intensity", Range(0, 1)) = .1
+ _VoronoiColor0 ("Color 0", Color) = (0, 0, 0, 1)
+ _VoronoiEmission0 ("Emission 0", Range(0, 20)) = 0
+ _VoronoiColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ _VoronoiEmission1 ("Emission 1", Range(0, 20)) = 0
+ [Vector2]_VoronoiGradient ("Gradient", Vector) = (.04, .05, 0, 0)
+ _VoronoiScale ("Scale", Float) = 5
+ [Vector3]_VoronoiSpeed ("Speed", Vector) = (3, 3, 3)
+ [HideInInspector] m_start_voronoiRandom ("Voronoi Random Cell Color", Float) = 0
+ [ToggleUI]_VoronoiEnableRandomCellColor ("Rando Cell Col", Float) = 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_end_Voronoi ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_BlackLight ("Black Light Mask", Float) = 0
+ [HideInInspector][Toggle(_SPECULARHIGHLIGHTS_OFF)]_BlackLightMaskEnabled ("Black Light Mask Enabled", Float) = 0
+ _BlackLightMaskKeys ("Mask Keys", Vector) = (2, 3, 4, 5)
+ _BlackLightMaskStart ("Gradient Start", Vector) = (0, 0, 0, 0)
+ _BlackLightMaskEnd ("Gradient End", Vector) = (1, 1, 1, 1)
+ [ToggleUI]_BlackLightMaskDebug ("Visualize", Float) = 0
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMetallic ("Metallic", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskClearCoat ("Clear Coat", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap ("Matcap 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap2 ("Matcap 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission ("Emission 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission2 ("Emission 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskFlipbook ("Flipbook", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskDissolve ("Dissolve", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskPanosphere ("Panosphere", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskGlitter ("Glitter", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskIridescence ("Iridescence", Int) = 4
+ [HideInInspector] m_end_BlackLight ("Black Light", Float) = 0
+ // End Patreon
+
+ // Parallax Mapping
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [Toggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ [Vector2]_ParallaxHeightMapPan ("Pan", Vector) = (0, 0, 0, 0)
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ParallaxUV ("Parallax UV", Int) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxHeightMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxHeightMapMaskUV ("UV", Int) = 0
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxInternalMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxInternalMapMaskUV ("UV", Int) = 0
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+ [HideInInspector] m_start_parallaxAdvanced ("Advanced", Float) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxAdvanced ("Advanced", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 0
+ _ZBias ("ZBias", Float) = 0.0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Debug Options
+ [HideInInspector] m_start_debugOptions ("Debug", Float) = 0
+ [HideInInspector][Toggle(_COLOROVERLAY_ON)]_DebugEnabled ("Display Debug Info", Float) = 0
+ _VertexUnwrap ("Unwrap", Range(0, 1)) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ [HideInInspector] m_end_debugOptions ("Debug", Float) = 0
+ }
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ //Blend SrcAlpha OneMinusSrcAlpha
+ Blend [_SourceBlend] [_DestinationBlend]
+ Tags { "Queue" = "Transparent+10" "RenderType" = "Transparent" }
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define FORWARD_BASE_PASS
+ #define TESSELATION
+ // Base Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // patreon Base
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // Uniform Tessellation
+ #pragma shader_feature _FADING_ON
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Touch Color
+ #pragma shader_feature GRAIN
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex poiTessellationVert
+ #pragma hull poiHull
+ #pragma domain poiDomain
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define FORWARD_ADD_PASS
+ #define TESSELATION
+ // Add Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // Uniform Tessellation
+ #pragma shader_feature _FADING_ON
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex poiTessellationVert
+ #pragma hull poiHull
+ #pragma domain poiDomain
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define POI_SHADOW
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/CGI_PoiPassShadow.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+ Cull Off
+ CGPROGRAM
+
+ #define POI_META_PASS
+ #define TRANSPARENT
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ }
+ Fallback "Toon/Lit Cutout (Double)"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Transparent_PPT.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Transparent_PPT.shader.meta
new file mode 100644
index 00000000..48fef672
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_T_Transparent_PPT.shader.meta
@@ -0,0 +1,84 @@
+fileFormatVersion: 2
+guid: f47fb494704d78b419457c18772e15f7
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {fileID: 2800000, guid: a6d6984545cde4a4f9317b17d6dca225, type: 3}
+ - _BumpMap: {instanceID: 0}
+ - _AlphaMask: {instanceID: 0}
+ - _RGBMask: {instanceID: 0}
+ - _RedTexure: {instanceID: 0}
+ - _GreenTexture: {instanceID: 0}
+ - _BlueTexture: {instanceID: 0}
+ - _DetailMask: {instanceID: 0}
+ - _DetailTex: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _VertexManipulationHeightMask: {instanceID: 0}
+ - _BackFaceTexture: {instanceID: 0}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ - _LightingShadowMask: {instanceID: 0}
+ - _AOMap: {instanceID: 0}
+ - _ToonRamp1: {instanceID: 0}
+ - _ToonRamp2: {instanceID: 0}
+ - _SSSThicknessMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ - _RimMask: {instanceID: 0}
+ - _RimWidthNoiseTexture: {instanceID: 0}
+ - _RimEnviroMask: {instanceID: 0}
+ - _CubeMap: {instanceID: 0}
+ - _MetallicMask: {instanceID: 0}
+ - _SmoothnessMask: {instanceID: 0}
+ - _ClearCoatCubeMap: {instanceID: 0}
+ - _ClearCoatMask: {instanceID: 0}
+ - _ClearCoatSmoothnessMask: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMask: {instanceID: 0}
+ - _Matcap2: {instanceID: 0}
+ - _Matcap2Mask: {instanceID: 0}
+ - _SpecularMap: {instanceID: 0}
+ - _SpecularMask: {instanceID: 0}
+ - _AnisoTangentMap: {instanceID: 0}
+ - _SpecularMap1: {instanceID: 0}
+ - _SpecularMask1: {instanceID: 0}
+ - _AnisoTangentMap1: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _EmissionScrollingCurve: {instanceID: 0}
+ - _EmissionMap1: {instanceID: 0}
+ - _EmissionMask1: {instanceID: 0}
+ - _EmissionScrollingCurve1: {instanceID: 0}
+ - _FlipbookTexArray: {instanceID: 0}
+ - _FlipbookMask: {instanceID: 0}
+ - _DissolveEdgeGradient: {instanceID: 0}
+ - _DissolveToTexture: {instanceID: 0}
+ - _DissolveNoiseTexture: {instanceID: 0}
+ - _DissolveDetailNoise: {instanceID: 0}
+ - _DissolveMask: {instanceID: 0}
+ - _PanosphereTexture: {instanceID: 0}
+ - _PanoMapTexture: {instanceID: 0}
+ - _PanoCubeMap: {instanceID: 0}
+ - _GlitterColorMap: {instanceID: 0}
+ - _GlitterMask: {instanceID: 0}
+ - _TextGlyphs: {instanceID: 0}
+ - _MirrorTexture: {instanceID: 0}
+ - _MainFadeTexture: {instanceID: 0}
+ - _DistortionFlowTexture: {instanceID: 0}
+ - _DistortionFlowTexture1: {instanceID: 0}
+ - _VideoPixelTexture: {instanceID: 0}
+ - _VideoMaskTexture: {instanceID: 0}
+ - _VideoDebugTexture: {instanceID: 0}
+ - _VideoGameboyRamp: {instanceID: 0}
+ - _BulgeMask: {instanceID: 0}
+ - _DepthGradient: {instanceID: 0}
+ - _DepthMask: {instanceID: 0}
+ - _HoloAlphaMap: {instanceID: 0}
+ - _IridescenceRamp: {instanceID: 0}
+ - _IridescenceNormalMap: {instanceID: 0}
+ - _IridescenceMask: {instanceID: 0}
+ - _SpawnInNoise: {instanceID: 0}
+ - _ParallaxHeightMap: {instanceID: 0}
+ - _ParallaxInternalMap: {instanceID: 0}
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeCutout_PPC.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeCutout_PPC.shader
new file mode 100644
index 00000000..2a656ae5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeCutout_PPC.shader
@@ -0,0 +1,1243 @@
+Shader ".poiyomi/Patreon/Wireframe Cutout"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#ff0000ff>❤</color> <color=#000000ff>Poiyomi Pro V6.1</color> <color=#ff0000ff>❤</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+ [HideInInspector] shader_properties_label_file ("PoiLabels", Float) = 0
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ // Main
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _MainTex ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 1)) = 0
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AlphaMaskUV ("UV", Int) = 0
+
+ //Hue Shifting
+ [HideInInspector] m_start_MainHueShift ("Hue Shift", Float) = 0
+ [HideInInspector][ToggleUI]_MainHueShiftToggle ("Toggle Hueshift", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Replace?", Float) = 1
+ _MainHueShift ("Hue Shift", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Shift Speed", Float) = 0
+ _MainHueShiftMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainHueShiftMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainHueShiftMaskUV ("UV", Int) = 0
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ // RGB Masking
+ [HideInInspector] m_start_RGBMask ("RGB Color Masking", Float) = 0
+ [HideInInspector][Toggle(FXAA)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ _RGBMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBMaskPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color", Color) = (1, 1, 1, 1)
+ _RedTexure ("R Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBRedPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBRed_UV ("UV", int) = 0
+ _GreenColor ("G Color", Color) = (1, 1, 1, 1)
+ _GreenTexture ("G Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBGreenPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBGreen_UV ("UV", int) = 0
+ _BlueColor ("B Color", Color) = (1, 1, 1, 1)
+ _BlueTexture ("B Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBBluePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBBlue_UV ("UV", int) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Detail Options
+ [HideInInspector] m_start_DetailOptions ("Details", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture Tint", Color) = (1, 1, 1)
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ //Vertex Manipulations
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map", 2D) = "while" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Division Amount", Float) = 500
+ [HideInInspector] m_end_vertexManipulation ("Vertex Options", Float) = 0
+
+ // Alpha Options
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.01
+ [ToggleUI]_DitheringEnabled ("Enable Dithering", Float) = 1
+ _DitherGradient ("Dither Gradient", Range(0, 1)) = .1
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 0
+ _MainShadowClipMod ("Shadow Clip Mod", Range(-1, 1)) = 0
+ [Enum(Off, 0, On, 1)] _AlphaToMask ("Alpha To Coverage", Float) = 0
+ [ToggleUI]_MainAlphaToCoverage ("Sharpenned A2C--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Float) = 0
+ _MainMipScale ("Mip Level Alpha Scale--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Range(0, 1)) = 0.25
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decal", Float) = 0
+ [HideInInspector][Toggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ _DecalColor ("Color", Color) = (1, 1, 1, 1)
+ _DecalTexture ("Decal", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalTextureUV ("UV", Int) = 0
+ _DecalMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalMaskUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ _DecalBlendAdd ("Add", Range(0, 1)) = 0
+ _DecalBlendMultiply ("Multiply", Range(0, 1)) = 0
+ _DecalBlendReplace ("Replace", Range(0, 1)) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face", Float) = 0
+ [ToggleUI]_BackFaceEnabled ("Enable Back Face Options", Float) = 0
+ _BackFaceTexture ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFacePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ _BackFaceHueShift ("Hue Shift", Range(0, 1)) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingOptions ("Lighting", Float) = 0
+ [HideInInspector] m_start_Lighting ("Light and Shadow", Float) = 0
+ [Toggle(LOD_FADE_CROSSFADE)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Natural, 0, Controlled, 1, Standardish, 2, Math, 3)] _LightingType ("Lighting Type", Int) = 1
+ [ToggleUI]_LightingMonochromatic ("Monochromatic?", Float) = 0
+ _LightingGradientStart ("Gradient Start--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = .5
+ _LightingStartColor ("Light Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ _LightingEndColor ("Shadow Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", 2D) = "white" { }
+ _LightingShadowMask ("Shadow Mask (RGBA)--{reference_properties:[_LightingShadowMaskPan, _LightingShadowMaskUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingShadowMaskUV ("UV", Int) = 0
+ _ShadowStrength ("Shadow Strength--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(0, 1)) = .2
+ _ShadowOffset ("Shadow Offset--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(-1, 1)) = 0
+ _LightingAOTex ("AO Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingAOTexUV ("UV", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 0
+ _LightingMinLightBrightness ("Min Brightness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 0
+ _LightingIndirectContribution ("Indirect Contribution--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = .2
+ _AttenuationMultiplier ("Recieve Casted Shadows?", Range(0, 1)) = 0
+ _LightingDetailShadows ("Detail Shadows--{reference_properties:[_LightingDetailShadowsPan, _LightingDetailShadowsUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingDetailShadowsUV ("UV", Int) = 0
+ _LightingDetailStrength ("Detail Strength--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 1
+ _LightingStandardSmoothness ("Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==2}}", Range(0, 1)) = 0
+
+ // Lighting Beta Options
+ [HideInInspector] m_start_lightingBeta ("Extra Ramps--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Float) = 0
+ _LightingNoIndirectThreshold ("Absent Indirect Threshold", Range(0, 1)) = 0.01
+ _LightingNoIndirectMultiplier ("Absent Indirect Multiplier", Range(0, 1)) = 0.5
+ [ToggleUI]_LightingStandardControlsToon ("Standard Lighting Controls Toon Ramp", Float) = 0
+ [IntRange]_LightingNumRamps ("Num Ramps", Range(1, 3)) = 1
+ [Gradient]_ToonRamp1 ("Lighting Ramp 2", 2D) = "white" { }
+ _LightingShadowStrength1 ("Shadow Strength 2", Range(0, 1)) = 1
+ _ShadowOffset1 ("Shadow Offset 2", Range(-1, 1)) = 0
+ [Gradient]_ToonRamp2 ("Lighting Ramp 3", 2D) = "white" { }
+ _LightingShadowStrength2 ("Shadow Strength 3", Range(0, 1)) = 1
+ _ShadowOffset2 ("Shadow Offset 3", Range(-1, 1)) = 0
+ [HideInInspector] m_end_lightingBeta ("Extra Ramps", Float) = 0
+
+ // point/spot Light Settings
+ [HideInInspector] m_start_lightingAdvanced ("Additive Lighting", Float) = 0
+ [Enum(Standard, 0, Controlled, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End", Range(0, 1)) = .5
+ _LightingAdditivePassthrough ("Point Light Passthrough", Range(0, 1)) = .5
+ _LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_lightingAdvanced ("Additive Lighting", Float) = 0
+ [HideInInspector] m_end_Lighting ("Light and Shadow", Float) = 0
+
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [Toggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSSCale ("Light Strength", Range(0, 1)) = 0.25
+ _SSSPower ("Light Spread", Range(1, 100)) = 5
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting", Float) = 0
+ [Toggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [Enum(vertex, 0, pixel, 1)] _RimLightNormal ("Normal Select", Int) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimMaskUV ("UV", Int) = 0
+
+ // Rim Noise
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_RimWidthNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimWidthNoiseTextureUV ("UV", Int) = 0
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Environmental Rim Lighting
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [Toggle(_MAPPING_6_FRAMES_LAYOUT)]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+
+ // Baked Lighting
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ // Metallics
+ [HideInInspector] m_start_Metallic ("Metallics", Float) = 0
+ [Toggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicTintMap ("Tint Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicTintMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicTintMapUV ("UV", Int) = 0
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicMaskUV ("UV", Int) = 0
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SmoothnessMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SmoothnessMaskUV ("UV", Int) = 0
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_Metallic ("Metallics", Float) = 0
+
+ // Clearcoat
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [Toggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ _ClearCoatCubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearCoatSampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearCoatMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatMaskUV ("UV", Int) = 0
+ _ClearCoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearCoatSmoothnessMap ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatSmoothnessMapUV ("UV", Int) = 0
+ [ToggleUI]_ClearCoatInvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 0
+ [ToggleUI]_ClearCoatForceLighting ("Force Lighting", Float) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap / Sphere Textures", Float) = 0
+ [Toggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MatcapMaskUV ("UV", Int) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_matcap ("Matcap", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ToggleUI]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _Matcap2MaskUV ("UV", Int) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ // Specular
+ [HideInInspector] m_start_specular ("Specular Reflections", Float) = 0
+ [Toggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3)] _SpecularType ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal ("Normal Select", Int) = 1
+ _SpecularAttenuation ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness ("Smoothness", Range(0, 1)) = 1
+ _SpecularMap ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMapUV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMaskUV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+
+ // Toon Specular
+ [HideInInspector] m_start_SpecularToon ("Toon", Float) = 0
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_SpecularToon ("Toon", Float) = 0
+
+ // Anisotropic Specular
+ [HideInInspector] m_start_Anisotropic ("Anisotropic", Float) = 0
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent ("(Bi)Tangent?", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha", Range(0, 1)) = 1
+ //_Spec1Offset ("Spec1 Offset", Float) = 0
+ //_Spec1JitterStrength ("Spec1 Jitter Strength", Float) = 1.0
+ _Spec2Smoothness ("Spec2 Smoothness", Range(0, 1)) = 0
+ //_Spec2Offset ("Spec2 Offset", Float) = 0
+ //_Spec2JitterStrength ("Spec2 Jitter Strength", Float) = 1.0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMapUV ("UV", Int) = 0
+ //_SpecularAnisoJitterMicro ("Shift Texture", 2D) = "black" { }
+ //[HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ //[HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [HideInInspector] m_end_Anisotropic ("Anisotropic", Float) = 0
+ [HideInInspector] m_end_specular ("Specular Reflections", Float) = 0
+
+ // Second Specular
+ [HideInInspector] m_start_specular1 ("Specular Reflections 2", Float) = 0
+ [ToggleUI]_EnableSpecular1 ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3)] _SpecularType1 ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal1 ("Normal Select", Int) = 1
+ _SpecularAttenuation1 ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint1 ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic1 ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness1 ("Smoothness", Range(-2, 1)) = .75
+ _SpecularMap1 ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMap1UV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness1 ("Invert Smoothness", Float) = 0
+ _SpecularMask1 ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMask1UV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom1 ("Smoothness From", Int) = 1
+
+ // Second Toon Specular
+ [HideInInspector] m_start_SpecularToon1 ("Toon", Float) = 0
+ [MultiSlider]_SpecularToonInnerOuter1 ("Inner/Outer Edge", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_SpecularToon1 ("Toon", Float) = 0
+
+ // Second Anisotropic Specular
+ [HideInInspector] m_start_Anisotropic1 ("Anisotropic", Float) = 0
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent1 ("(Bi)Tangent?", Int) = 0
+ _AnisoSpec1Alpha1 ("Spec1 Alpha", Range(0, 1)) = 1
+ _AnisoSpec2Alpha1 ("Spec2 Alpha", Range(0, 1)) = 1
+ //_Spec1Offset ("Spec1 Offset", Float) = 0
+ //_Spec1JitterStrength ("Spec1 Jitter Strength", Float) = 1.0
+ _Spec2Smoothness1 ("Spec2 Smoothness", Range(0, 1)) = 0
+ //_Spec2Offset ("Spec2 Offset", Float) = 0
+ //_Spec2JitterStrength ("Spec2 Jitter Strength", Float) = 1.0
+ [ToggleUI]_AnisoUseTangentMap1 ("Use Directional Map?", Float) = 0
+ _AnisoTangentMap1 ("Anisotropic Directional Map", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMap1UV ("UV", Int) = 0
+ //_SpecularAnisoJitterMicro ("Shift Texture", 2D) = "black" { }
+ //[HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ //[HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [HideInInspector] m_end_Anisotropic1 ("Anisotropic", Float) = 0
+ [HideInInspector] m_end_specular1 ("Specular Reflections", Float) = 0
+
+ // Fist Emission
+ [HideInInspector] m_Special_Effects ("Special Effects", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission / Glow", Float) = 0
+ [Toggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMapUV ("UV", Int) = 0
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMaskUV ("UV", Int) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0
+
+ // Center out emission
+ [HideInInspector] m_start_CenterOutEmission ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission ("inward out emission", Float) = 0
+
+ // Glow in the dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ // Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ _EmissionScrollingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emissionOptions ("Emission / Glow", Float) = 0
+
+ // Second Enission
+ [HideInInspector] m_start_emission1Options ("Emission / Glow 2 (Requires Emission 1 Enabled)", Float) = 0
+ [ToggleUI]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap1 ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMap1UV ("UV", Int) = 0
+ _EmissionMask1 ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMask1UV ("UV", Int) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled1 ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0
+
+ // Second Center Out Enission
+ [HideInInspector] m_start_CenterOutEmission1 ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled1 ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission1 ("inward out emission", Float) = 0
+
+ // Second Glow In The Dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission1 ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Second Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max1 ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+
+ // Scrolling Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions1 ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission1 ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction1 ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval", Float) = 20
+ _EmissionScrollingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmission1Options ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emission1Options ("Emission / Glow 2", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook", Float) = 0
+ [Toggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookTexArrayUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookMaskUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Int) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+
+ // Flipbook Manual Control
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve", Float) = 0
+ [Toggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolved Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Noise", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Detail Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_dissolveMasking ("Effect Masking", Float) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmissionSide ("Emission 1", Int) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmission1Side ("Emission 2", Int) = 0
+ [HideInInspector] m_end_dissolveMasking ("Effect Masking", Float) = 0
+
+ // Point to Point Dissolve
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Panosphere
+ [HideInInspector] m_start_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [Toggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ [ToggleUI]_PanoInfiniteStereoToggle ("Infinite Stereo", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_PanoMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _PanoMaskUV ("UV", Int) = 0
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+ [HideInInspector] m_end_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle", Float) = 0
+ [Toggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ //[Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Type", Int) = 0
+ [HDR]_GlitterColor ("Color", Color) = (1, 1, 1)
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Wobble Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias", Range(0, 1)) = .8
+
+ // Glitter Random Colors
+ [HideInInspector] m_start_glitterRandom ("Random Colors", Float) = 0
+ [ToggleUI]_GlitterRandomColors ("Enable", Float) = 0
+ [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1)
+ [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1)
+ [HideInInspector] m_end_glitterRandom ("Random Colors", Float) = 0
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("MSDF Text Overlay", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [Toggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS", Float) = 0
+ [ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color", Color) = (1, 1, 1, 1)
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextFPS ("FPS", Float) = 0
+
+ // POSITION
+ [HideInInspector] m_start_TextPosition ("Position", Float) = 0
+ [ToggleUI]_TextPositionEnabled ("Position Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color", Color) = (1, 0, 1, 1)
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextPosition ("Position", Float) = 0
+
+ // INSTANCE TIME
+ [HideInInspector] m_start_TextInstanceTime ("Instance Time", Float) = 0
+ [ToggleUI]_TextTimeEnabled ("Time Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color", Color) = (1, 0, 1, 1)
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror", Float) = 0
+ [Toggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MirrorTextureUV ("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ // Distance Fade
+ [HideInInspector] m_start_distanceFade ("Distance Fade", Float) = 0
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainFadeTexture ("Fade Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainFadeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainFadeTextureUV ("UV", Int) = 0
+ [Vector2]_MainDistanceFade ("Distance Fade X to Y", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_distanceFade ("Distance Fade", Float) = 0
+
+ // Angular Fade
+ [HideInInspector] m_start_angularFade ("Angular Fade", Float) = 0
+ [Toggle(_SUNDISK_NONE)]_EnableRandom ("Enable Angular Fade", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_angularFade ("Angular Fade", Float) = 0
+
+ // UV Distortion
+ [HideInInspector] m_start_distortionFlow ("UV Distortion", Float) = 0
+ [Toggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ _DistortionFlowTexture ("Distortion Texture 1", 2D) = "black" { }
+ _DistortionFlowTexture1 ("Distortion Texture 2", 2D) = "black" { }
+ _DistortionStrength ("Strength1", Float) = 0.5
+ _DistortionStrength1 ("Strength2", Float) = 0.5
+ [Vector2]_DistortionSpeed ("Speed1", Vector) = (0.5, 0.5, 0, 0)
+ [Vector2]_DistortionSpeed1 ("Speed2", Vector) = (0.5, 0.5, 0, 0)
+ [HideInInspector] m_end_distortionFlow ("UV Distortion", Float) = 0
+
+ // Start Patreon
+ [HideInInspector] m_Patreon ("Patreon", Float) = 0
+ [HideInInspector] m_start_Video ("Video", Float) = 0
+ [Toggle(BLOOM)] _EnableVideo ("Enable Video", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VideoUVNumber ("Screen UV#", Int) = 0
+ [Enum(LCD, 0, TN, 1, CRT, 2, OLED, 3, Gameboy, 4, Projector, 5)] _VideoType ("Screen Type", Int) = 3
+ _VideoBacklight ("Brightness", Range(0, 100)) = 1
+ _VideoPixelTexture ("Pixel Texture", 2D) = "white" { }
+ [Vector2]_VideoResolution ("Resolution", Vector) = (1280, 720, 0)
+ _VideoMaskTexture ("Mask", 2D) = "white" { }
+ [Vector2]_VideoMaskPanning ("Mask Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_VideoSettings ("Video Texture Settings", Float) = 0
+ [ToggleUI]_VideoEnableVideoPlayer ("Enable Video Player", Float) = 0
+ [ToggleUI]_VideoPixelateToResolution ("Pixelate To Resolution", Float) = 0
+ [ToggleUI]_VideoRepeatVideoTexture ("Clamp To UV", Float) = 0
+ [Vector2]_VideoPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_VideoTiling ("Tiling", Vector) = (1, 1, 0, 0)
+ [Vector2]_VideoOffset ("Offset", Vector) = (0, 0, 0, 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_VideoDebug ("Video Debug", Float) = 0
+ [ToggleUI]_VideoEnableDebug ("Enable Debug", Float) = 0
+ _VideoDebugTexture ("Video Debug Tex", 2D) = "white" { }
+ [HideInInspector] m_end_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_start_CRT ("CRT Options", 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", Float) = 0
+ [Gradient]_VideoGameboyRamp ("Color Ramp", 2D) = "white" { }
+ [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Video ("Video", Float) = 0
+
+ [HideInInspector] m_start_TouchOptions ("Touch FX", Float) = 0
+ [HideInInspector] m_start_Bulge ("Bulge", Float) = 0
+ [Toggle(BLOOM_LOW)] _EnableBulge ("Bulge", Float) = 0
+ _BulgeMask ("Bulge Mask", 2D) = "white" { }
+ _BuldgeFadeLength ("Touch Distance", Float) = 0.02
+ _BuldgeHeight ("Bulge Height", Range(-0.2, 0.2)) = 0.02
+ [HideInInspector] m_end_Bulge ("Bulge", Float) = 0
+
+ [HideInInspector] m_start_TouchGlow ("Touch Color", Float) = 0
+ [Toggle(GRAIN)]_EnableTouchGlow ("Enable Touch Glow", Float) = 0
+ _DepthGlowColor ("Depth Glow Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DepthGradient ("Depth Gradient", 2D) = "white" { }
+ _DepthMask ("Depth Mask", 2D) = "white" { }
+ _DepthGlowEmission ("Depth Glow Emission", Float) = 3
+ _FadeLength ("Fade Length", Float) = 0.02
+ _DepthAlphaMin ("Alpha Min", Range(0, 1)) = 1
+ _DepthAlphaMax ("Alpha Max", Range(0, 1)) = 1
+ [HideInInspector] m_end_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchOptions ("Touch FX", Float) = 0
+
+ [HideInInspector] m_start_Hologram ("Hologram Alpha", Float) = 0
+ [Toggle(DEPTH_OF_FIELD)]_EnableHolo ("Enable Hologram Alpha", Float) = 0
+ [Curve]_HoloAlphaMap ("Alpha Map", 2D) = "white" { }
+ [Enum(World Space, 0, Local Space, 1, UV, 2)]_HoloCoordinateSpace ("Coordinate Space", Int) = 0
+ _HoloDirection ("Scroll Direction", Vector) = (0, 1, 0)
+ _HoloLineDensity ("Line Density", Float) = 10
+ _HoloScrollSpeed ("Scroll Speed", Float) = 1
+ [HideInInspector] m_start_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ _HoloFresnelAlpha ("Intensity", Range(0, 1)) = 0
+ _HoloRimSharpness ("Sharpness", Range(0, 1)) = .5
+ _HoloRimWidth ("Width", Range(0, 1)) = .5
+ [HideInInspector] m_end_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_Hologram ("Hologram Alpha", Float) = 0
+
+ [HideInInspector] m_start_wireframe ("Wireframe", Float) = 0
+ [ToggleUI]_WireframeEnable ("Enable Wireframe", Float) = 0
+ [ToggleUI]_WireframeQuad ("Quad", Float) = 0
+ _WireframeColor ("Wireframe Color", Color) = (1, 1, 1, 1)
+ _WireframeTexture ("Color Map", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _WireframeUV ("UV#", Int) = 0
+ [Vector2]_WireframeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ _WireframeEmissionStrength ("Emission Strength", Range(0, 30)) = 0
+ _WireframeThickness ("Thickness", Range(0, 20)) = 0
+ _WireframeEdgeOpacity ("Edge Opacity", Range(0, 1)) = 1
+ _WireframeFaceOpacity ("Face Opacity", Range(0, 1)) = .01
+ [HideInInspector] m_end_wireframe ("Wireframe", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence", Float) = 0
+ [Toggle(BLOOM_LENS_DIRT)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp", 2D) = "white" { }
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map", 2D) = "bump" { }
+ _IridescenceMask ("Mask", 2D) = "white" { }
+ _IridescenceNormalIntensity("Normal Intensity", Range(0,10)) = 1
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceNormalUV ("Normal UV", Int) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceMaskUV ("Mask UV", Int) = 0
+ [Enum(vertex, 0, pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity("Intensity", Range(0,10)) = 1
+ _IridescenceAddBlend("Blend Add", Range(0,1)) = 0
+ _IridescenceReplaceBlend("Blend Replace", Range(0,1)) = 0
+ _IridescenceMultiplyBlend("Blend Multiply", Range(0,1)) = 0
+ _IridescenceEmissionStrength("Emission Strength", Range(0,20)) = 0
+ [Enum(Run Early, 0, Run Late, 1)] _IridescenceTime ("When To Run", Int) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ [HideInInspector] m_start_VertexGlitch ("Vertex Glitching", Float) = 0
+ [ToggleUI]_EnableVertexGlitch ("Enable Vertex Glitching", Float) = 0
+ _VertexGlitchFrequency ("Glitch Interval", Float) = 0
+ _VertexGlitchThreshold ("Glitch Threshold", Range(0, 1)) = 1
+ _VertexGlitchStrength ("Glitch Strength", Range(0, 10)) = 1
+ [HideInInspector] m_end_VertexGlitch ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_Spawns ("Spawns", Float) = 0
+ [HideInInspector] m_start_ScifiSpawnIn ("Sci Fi", Float) = 0
+ [ToggleUI]_EnableScifiSpawnIn ("Enable Sci Fi Spawn", Float) = 0
+ _SpawnInNoise ("Spawn Noise", 2D) = "black" { }
+ _SpawnInNoiseIntensity ("Noise Intensity", Range(0, 1)) = .35
+ _SpawnInAlpha ("Spawn Alpha", Range(0, 1)) = 0
+ [Vector3]_SpawnInGradientStart ("Gradient Start", Vector) = (0, 2, 0)
+ [Vector3]_SpawnInGradientFinish ("Gradient End", Vector) = (0, -2, 0)
+ [HDR]_SpawnInEmissionColor ("Emission Color", Color) = (1, 1, 1)
+ _SpawnInEmissionOffset ("Emission Width", Range(0, 1)) = .1
+ _SpawnInVertOffset ("Vertex Offset Speed", Float) = 10
+ _SpawnInVertOffsetOffset ("vert width", Range(0, 1)) = .1
+ [HideInInspector] m_end_SciFiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_Spawns ("Spawns", Float) = 0
+
+ // Voronoi
+ [HideInInspector] m_start_Voronoi ("Vertex Glitching", Float) = 0
+ [Enum(2D (Fast), 0, 3D (Fast with color bugs), 1, 3D (slow but no bugs), 2)] _VoronoiType ("Space", Int) = 1
+ [Enum(Local, 0, World, 1, UV, 2)] _VoronoiSpace ("Space", Int) = 0
+ [Enum(Color and Emission, 0, Just Emission, 1)] _VoronoiBlend ("Blend", Int) = 0
+ [Toggle(CHROMATIC_ABERRATION)]_EnableVoronoi ("Enable Voronoi", Float) = 0
+ _VoronoiMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_VoronoiMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiMaskUV ("UV", Int) = 0
+ _VoronoiNoise ("Edge Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_VoronoiNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiNoiseUV ("UV", Int) = 0
+ _VoronoiNoiseIntensity ("Noise Intensity", Range(0,1)) = .1
+ _VoronoiColor0 ("Color 0", Color) = (0, 0, 0, 1)
+ _VoronoiEmission0 ("Emission 0", Range(0, 20)) = 0
+ _VoronoiColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ _VoronoiEmission1 ("Emission 1", Range(0, 20)) = 0
+ [Vector2]_VoronoiGradient ("Gradient", Vector) = (.04, .05, 0, 0)
+ _VoronoiScale ("Scale", Float) = 5
+ [Vector3]_VoronoiSpeed ("Speed", Vector) = (3, 3, 3)
+ [HideInInspector] m_start_voronoiRandom("Voronoi Random Cell Color", Float) = 0
+ [ToggleUI]_VoronoiEnableRandomCellColor ("Rando Cell Col", Float) = 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_end_Voronoi ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_BlackLight ("Black Light Mask", Float) = 0
+ [HideInInspector][Toggle(_SPECULARHIGHLIGHTS_OFF)]_BlackLightMaskEnabled ("Black Light Mask Enabled", Float) = 0
+ _BlackLightMaskKeys ("Mask Keys", Vector) = (2, 3, 4, 5)
+ _BlackLightMaskStart ("Gradient Start", Vector) = (0, 0, 0, 0)
+ _BlackLightMaskEnd ("Gradient End", Vector) = (1, 1, 1, 1)
+ [ToggleUI]_BlackLightMaskDebug ("Visualize", Float) = 0
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMetallic ("Metallic", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskClearCoat ("Clear Coat", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap ("Matcap 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap2 ("Matcap 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission ("Emission 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission2 ("Emission 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskFlipbook ("Flipbook", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskDissolve ("Dissolve", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskPanosphere ("Panosphere", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskGlitter ("Glitter", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskIridescence ("Iridescence", Int) = 4
+ [HideInInspector] m_end_BlackLight ("Black Light", Float) = 0
+ // End Patreon
+
+ // Parallax Mapping
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [Toggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ [Vector2]_ParallaxHeightMapPan ("Pan", Vector) = (0, 0, 0, 0)
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ParallaxUV ("Parallax UV", Int) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxHeightMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxHeightMapMaskUV ("UV", Int) = 0
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxInternalMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxInternalMapMaskUV ("UV", Int) = 0
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+ [HideInInspector] m_start_parallaxAdvanced ("Advanced", Float) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxAdvanced ("Advanced", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ _ZBias ("ZBias", Float) = 0.0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Debug Options
+ [HideInInspector] m_start_debugOptions ("Debug", Float) = 0
+ [HideInInspector][Toggle(_COLOROVERLAY_ON)]_DebugEnabled ("Display Debug Info", Float) = 0
+ _VertexUnwrap ("Unwrap", Range(0, 1)) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ [HideInInspector] m_end_debugOptions ("Debug", Float) = 0
+ }
+
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "RenderType" = "TransparentCutout" "Queue" = "AlphaTest+10"}
+ Pass
+ {
+ Name "MainPass"
+ Tags {"LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_BASE_PASS
+ #define WIREFRAME
+ #define CUTOUT
+ // Base Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // patreon Base
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Touch Color
+ #pragma shader_feature GRAIN
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+#pragma shader_feature BLOOM_LENS_DIRT
+// Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma geometry wireframeGeom
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define FORWARD_ADD_PASS
+ #define BINORMAL_PER_FRAGMENT
+ #define WIREFRAME
+ #define CUTOUT
+ // Add Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+#pragma shader_feature BLOOM_LENS_DIRT
+// Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma geometry wireframeGeom
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define CUTOUT
+ #define WIREFRAME
+ #define POI_SHADOW
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma geometry wireframeGeom
+ #pragma fragment fragShadowCaster
+ #include "../Includes/CGI_PoiPassShadow.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+ Cull Off
+ CGPROGRAM
+
+ #define POI_META_PASS
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+#pragma shader_feature BLOOM_LENS_DIRT
+// Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ }
+ Fallback "Toon/Lit Cutout (Double)"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeCutout_PPC.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeCutout_PPC.shader.meta
new file mode 100644
index 00000000..3eefcbd8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeCutout_PPC.shader.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 234617342c2c81246983373bf1315cf7
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT.shader
new file mode 100644
index 00000000..61b22e13
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT.shader
@@ -0,0 +1,1244 @@
+Shader ".poiyomi/Patreon/Wireframe Transparent"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#ff0000ff>❤</color> <color=#000000ff>Poiyomi Pro V6.1</color> <color=#ff0000ff>❤</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+ [HideInInspector] shader_properties_label_file ("PoiLabels", Float) = 0
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ // Main
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _MainTex ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 1)) = 0
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AlphaMaskUV ("UV", Int) = 0
+
+ //Hue Shifting
+ [HideInInspector] m_start_MainHueShift ("Hue Shift", Float) = 0
+ [HideInInspector][ToggleUI]_MainHueShiftToggle ("Toggle Hueshift", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Replace?", Float) = 1
+ _MainHueShift ("Hue Shift", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Shift Speed", Float) = 0
+ _MainHueShiftMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainHueShiftMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainHueShiftMaskUV ("UV", Int) = 0
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ // RGB Masking
+ [HideInInspector] m_start_RGBMask ("RGB Color Masking", Float) = 0
+ [HideInInspector][Toggle(FXAA)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ _RGBMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBMaskPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color", Color) = (1, 1, 1, 1)
+ _RedTexure ("R Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBRedPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBRed_UV ("UV", int) = 0
+ _GreenColor ("G Color", Color) = (1, 1, 1, 1)
+ _GreenTexture ("G Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBGreenPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBGreen_UV ("UV", int) = 0
+ _BlueColor ("B Color", Color) = (1, 1, 1, 1)
+ _BlueTexture ("B Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBBluePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_RGBBlue_UV ("UV", int) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Detail Options
+ [HideInInspector] m_start_DetailOptions ("Details", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture Tint", Color) = (1, 1, 1)
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ //Vertex Manipulations
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map", 2D) = "while" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Division Amount", Float) = 500
+ [HideInInspector] m_end_vertexManipulation ("Vertex Options", Float) = 0
+
+ // Alpha Options
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.01
+ [ToggleUI]_DitheringEnabled ("Enable Dithering", Float) = 1
+ _DitherGradient ("Dither Gradient", Range(0, 1)) = .1
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 0
+ _MainShadowClipMod ("Shadow Clip Mod", Range(-1, 1)) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decal", Float) = 0
+ [HideInInspector][Toggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ _DecalColor ("Color", Color) = (1, 1, 1, 1)
+ _DecalTexture ("Decal", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalTextureUV ("UV", Int) = 0
+ _DecalMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DecalMaskUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ _DecalBlendAdd ("Add", Range(0, 1)) = 0
+ _DecalBlendMultiply ("Multiply", Range(0, 1)) = 0
+ _DecalBlendReplace ("Replace", Range(0, 1)) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face", Float) = 0
+ [ToggleUI]_BackFaceEnabled ("Enable Back Face Options", Float) = 0
+ _BackFaceTexture ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFacePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ _BackFaceHueShift ("Hue Shift", Range(0, 1)) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingOptions ("Lighting", Float) = 0
+ [HideInInspector] m_start_Lighting ("Light and Shadow", Float) = 0
+ [Toggle(LOD_FADE_CROSSFADE)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Natural, 0, Controlled, 1, Standardish, 2, Math, 3)] _LightingType ("Lighting Type", Int) = 1
+ [ToggleUI]_LightingMonochromatic ("Monochromatic?", Float) = 0
+ _LightingGradientStart ("Gradient Start--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Range(0, 1)) = .5
+ _LightingStartColor ("Light Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ _LightingEndColor ("Shadow Tint--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==3}}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", 2D) = "white" { }
+ _LightingShadowMask ("Shadow Mask (RGBA)--{reference_properties:[_LightingShadowMaskPan, _LightingShadowMaskUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingShadowMaskUV ("UV", Int) = 0
+ _ShadowStrength ("Shadow Strength--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(0, 1)) = .2
+ _ShadowOffset ("Shadow Offset--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Range(-1, 1)) = 0
+ _LightingAOTex ("AO Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingAOTexUV ("UV", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 0
+ _LightingMinLightBrightness ("Min Brightness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 0
+ _LightingIndirectContribution ("Indirect Contribution--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = .2
+ _AttenuationMultiplier ("Recieve Casted Shadows?", Range(0, 1)) = 0
+ _LightingDetailShadows ("Detail Shadows--{reference_properties:[_LightingDetailShadowsPan, _LightingDetailShadowsUV],condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _LightingDetailShadowsUV ("UV", Int) = 0
+ _LightingDetailStrength ("Detail Strength--{condition_show:{type:PROPERTY_BOOL,data:_LightingType!=2}}", Range(0, 1)) = 1
+ _LightingStandardSmoothness ("Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_LightingType==2}}", Range(0, 1)) = 0
+
+ // Lighting Beta Options
+ [HideInInspector] m_start_lightingBeta ("Extra Ramps--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingType==0},condition2:{type:PROPERTY_BOOL,data:_LightingType==1}}}", Float) = 0
+ _LightingNoIndirectThreshold ("Absent Indirect Threshold", Range(0, 1)) = 0.01
+ _LightingNoIndirectMultiplier ("Absent Indirect Multiplier", Range(0, 1)) = 0.5
+ [ToggleUI]_LightingStandardControlsToon ("Standard Lighting Controls Toon Ramp", Float) = 0
+ [IntRange]_LightingNumRamps ("Num Ramps", Range(1, 3)) = 1
+ [Gradient]_ToonRamp1 ("Lighting Ramp 2", 2D) = "white" { }
+ _LightingShadowStrength1 ("Shadow Strength 2", Range(0, 1)) = 1
+ _ShadowOffset1 ("Shadow Offset 2", Range(-1, 1)) = 0
+ [Gradient]_ToonRamp2 ("Lighting Ramp 3", 2D) = "white" { }
+ _LightingShadowStrength2 ("Shadow Strength 3", Range(0, 1)) = 1
+ _ShadowOffset2 ("Shadow Offset 3", Range(-1, 1)) = 0
+ [HideInInspector] m_end_lightingBeta ("Extra Ramps", Float) = 0
+
+ // point/spot Light Settings
+ [HideInInspector] m_start_lightingAdvanced ("Additive Lighting", Float) = 0
+ [Enum(Standard, 0, Controlled, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End", Range(0, 1)) = .5
+ _LightingAdditivePassthrough ("Point Light Passthrough", Range(0, 1)) = .5
+ _LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_lightingAdvanced ("Additive Lighting", Float) = 0
+ [HideInInspector] m_end_Lighting ("Light and Shadow", Float) = 0
+
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [Toggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSSCale ("Light Strength", Range(0, 1)) = 0.25
+ _SSSPower ("Light Spread", Range(1, 100)) = 5
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting", Float) = 0
+ [Toggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [Enum(vertex, 0, pixel, 1)] _RimLightNormal ("Normal Select", Int) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimMaskUV ("UV", Int) = 0
+
+ // Rim Noise
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_RimWidthNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimWidthNoiseTextureUV ("UV", Int) = 0
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Environmental Rim Lighting
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [Toggle(_MAPPING_6_FRAMES_LAYOUT)]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+
+ // Baked Lighting
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ // Metallics
+ [HideInInspector] m_start_Metallic ("Metallics", Float) = 0
+ [Toggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicTintMap ("Tint Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicTintMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicTintMapUV ("UV", Int) = 0
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MetallicMaskUV ("UV", Int) = 0
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SmoothnessMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SmoothnessMaskUV ("UV", Int) = 0
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_Metallic ("Metallics", Float) = 0
+
+ // Clearcoat
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [Toggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ _ClearCoatCubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearCoatSampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearCoatMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatMaskUV ("UV", Int) = 0
+ _ClearCoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearCoatSmoothnessMap ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClearCoatSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ClearCoatSmoothnessMapUV ("UV", Int) = 0
+ [ToggleUI]_ClearCoatInvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 0
+ [ToggleUI]_ClearCoatForceLighting ("Force Lighting", Float) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap / Sphere Textures", Float) = 0
+ [Toggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MatcapMaskUV ("UV", Int) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_matcap ("Matcap", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ToggleUI]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _Matcap2MaskUV ("UV", Int) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ // Specular
+ [HideInInspector] m_start_specular ("Specular Reflections", Float) = 0
+ [Toggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal ("Normal Select", Int) = 1
+ _SpecularAttenuation ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType==3}}}", Range(0, 1)) = 1
+ [Gradient]_SpecularMap ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMapUV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMaskUV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ // Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _Spec1Offset ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMapPan, _AnisoTangentMapUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMapUV ("UV", Int) = 0
+ //toon aniso
+ _SpecularToonStart ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicroPan, _SpecularAnisoJitterMicroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacroPan, _SpecularAnisoJitterMacroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMacroUV ("UV", Int) = 0
+ // Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular ("Specular Reflections", Float) = 0
+
+ // Second Specular
+ [HideInInspector] m_start_specular1 ("Specular Reflections 2", Float) = 0
+ [ToggleUI]_EnableSpecular1 ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType1 ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal1 ("Normal Select", Int) = 1
+ _SpecularAttenuation1 ("Attenuation Strength", Range(0, 1)) = 1
+ _SpecularTint1 ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic1 ("Metallic", Range(0, 1)) = 0
+ _SpecularSmoothness1 ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==3}}}", Range(-2, 1)) = .75
+ _SpecularMap1 ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMap1UV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness1 ("Invert Smoothness", Float) = 0
+ _SpecularMask1 ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularMask1UV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom1 ("Smoothness From", Int) = 1
+ // Second Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent1 ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Int) = 0
+ _AnisoSpec1Alpha1 ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha1 ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _Spec1Offset1 ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness1 ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap1 ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Float) = 0
+ _AnisoTangentMap1 ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMap1Pan, _AnisoTangentMap1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _AnisoTangentMap1UV ("UV", Int) = 0
+ // Second toon aniso
+ _SpecularToonStart1 ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd1 ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor1 ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored1("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro1 ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicro1Pan, _SpecularAnisoJitterMicro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier1 ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMicro1UV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro1 ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacro1Pan, _SpecularAnisoJitterMacro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier1 ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _SpecularAnisoJitterMacro1UV ("UV", Int) = 0
+ // Second Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter1 ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular1 ("Specular Reflections", Float) = 0
+
+ // Fist Emission
+ [HideInInspector] m_Special_Effects ("Special Effects", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission / Glow", Float) = 0
+ [Toggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMapUV ("UV", Int) = 0
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMaskUV ("UV", Int) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0
+
+ // Center out emission
+ [HideInInspector] m_start_CenterOutEmission ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission ("inward out emission", Float) = 0
+
+ // Glow in the dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ // Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ _EmissionScrollingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emissionOptions ("Emission / Glow", Float) = 0
+
+ // Second Enission
+ [HideInInspector] m_start_emission1Options ("Emission / Glow 2 (Requires Emission 1 Enabled)", Float) = 0
+ [ToggleUI]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap1 ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMap1UV ("UV", Int) = 0
+ _EmissionMask1 ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _EmissionMask1UV ("UV", Int) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled1 ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0
+
+ // Second Center Out Enission
+ [HideInInspector] m_start_CenterOutEmission1 ("Center Out Emission", Float) = 0
+ [ToggleUI]_EmissionCenterOutEnabled1 ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission1 ("inward out emission", Float) = 0
+
+ // Second Glow In The Dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [ToggleUI]_EnableGITDEmission1 ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Second Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max1 ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+
+ // Scrolling Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions1 ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission1 ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve", 2D) = "white" { }
+ _EmissiveScroll_Direction1 ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval", Float) = 20
+ _EmissionScrollingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmission1Options ("Scrolling Emission", Float) = 0
+ [HideInInspector] m_end_emission1Options ("Emission / Glow 2", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook", Float) = 0
+ [Toggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookTexArrayUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _FlipbookMaskUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Int) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+
+ // Flipbook Manual Control
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve", Float) = 0
+ [Toggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolved Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Noise", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Detail Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _DissolveMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_dissolveMasking ("Effect Masking", Float) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmissionSide ("Emission 1", Int) = 0
+ [Enum(Undissolved, 0, Dissolved, 1)] _DissolveEmission1Side ("Emission 2", Int) = 0
+ [HideInInspector] m_end_dissolveMasking ("Effect Masking", Float) = 0
+
+ // Point to Point Dissolve
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Panosphere
+ [HideInInspector] m_start_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [Toggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ [ToggleUI]_PanoInfiniteStereoToggle ("Infinite Stereo", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_PanoMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _PanoMaskUV ("UV", Int) = 0
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+ [HideInInspector] m_end_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle", Float) = 0
+ [Toggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ //[Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Type", Int) = 0
+ [HDR]_GlitterColor ("Color", Color) = (1, 1, 1)
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Wobble Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias", Range(0, 1)) = .8
+
+ // Glitter Random Colors
+ [HideInInspector] m_start_glitterRandom ("Random Colors", Float) = 0
+ [ToggleUI]_GlitterRandomColors ("Enable", Float) = 0
+ [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1)
+ [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1)
+ [HideInInspector] m_end_glitterRandom ("Random Colors", Float) = 0
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("MSDF Text Overlay", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [Toggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS", Float) = 0
+ [ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color", Color) = (1, 1, 1, 1)
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextFPS ("FPS", Float) = 0
+
+ // POSITION
+ [HideInInspector] m_start_TextPosition ("Position", Float) = 0
+ [ToggleUI]_TextPositionEnabled ("Position Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color", Color) = (1, 0, 1, 1)
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextPosition ("Position", Float) = 0
+
+ // INSTANCE TIME
+ [HideInInspector] m_start_TextInstanceTime ("Instance Time", Float) = 0
+ [ToggleUI]_TextTimeEnabled ("Time Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color", Color) = (1, 0, 1, 1)
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror", Float) = 0
+ [Toggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MirrorTextureUV ("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ // Distance Fade
+ [HideInInspector] m_start_distanceFade ("Distance Fade", Float) = 0
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainFadeTexture ("Fade Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainFadeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainFadeTextureUV ("UV", Int) = 0
+ [Vector2]_MainDistanceFade ("Distance Fade X to Y", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_distanceFade ("Distance Fade", Float) = 0
+
+ // Angular Fade
+ [HideInInspector] m_start_angularFade ("Angular Fade", Float) = 0
+ [Toggle(_SUNDISK_NONE)]_EnableRandom ("Enable Angular Fade", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_angularFade ("Angular Fade", Float) = 0
+
+ // UV Distortion
+ [HideInInspector] m_start_distortionFlow ("UV Distortion", Float) = 0
+ [Toggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ _DistortionFlowTexture ("Distortion Texture 1", 2D) = "black" { }
+ _DistortionFlowTexture1 ("Distortion Texture 2", 2D) = "black" { }
+ _DistortionStrength ("Strength1", Float) = 0.5
+ _DistortionStrength1 ("Strength2", Float) = 0.5
+ [Vector2]_DistortionSpeed ("Speed1", Vector) = (0.5, 0.5, 0, 0)
+ [Vector2]_DistortionSpeed1 ("Speed2", Vector) = (0.5, 0.5, 0, 0)
+ [HideInInspector] m_end_distortionFlow ("UV Distortion", Float) = 0
+
+ // Start Patreon
+ [HideInInspector] m_Patreon ("Patreon", Float) = 0
+ [HideInInspector] m_start_Video ("Video", Float) = 0
+ [Toggle(BLOOM)] _EnableVideo ("Enable Video", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VideoUVNumber ("Screen UV#", Int) = 0
+ [Enum(LCD, 0, TN, 1, CRT, 2, OLED, 3, Gameboy, 4, Projector, 5)] _VideoType ("Screen Type", Int) = 3
+ _VideoBacklight ("Brightness", Range(0, 100)) = 1
+ _VideoPixelTexture ("Pixel Texture", 2D) = "white" { }
+ [Vector2]_VideoResolution ("Resolution", Vector) = (1280, 720, 0)
+ _VideoMaskTexture ("Mask", 2D) = "white" { }
+ [Vector2]_VideoMaskPanning ("Mask Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_VideoSettings ("Video Texture Settings", Float) = 0
+ [ToggleUI]_VideoEnableVideoPlayer ("Enable Video Player", Float) = 0
+ [ToggleUI]_VideoPixelateToResolution ("Pixelate To Resolution", Float) = 0
+ [ToggleUI]_VideoRepeatVideoTexture ("Clamp To UV", Float) = 0
+ [Vector2]_VideoPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_VideoTiling ("Tiling", Vector) = (1, 1, 0, 0)
+ [Vector2]_VideoOffset ("Offset", Vector) = (0, 0, 0, 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_VideoDebug ("Video Debug", Float) = 0
+ [ToggleUI]_VideoEnableDebug ("Enable Debug", Float) = 0
+ _VideoDebugTexture ("Video Debug Tex", 2D) = "white" { }
+ [HideInInspector] m_end_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_start_CRT ("CRT Options", 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", Float) = 0
+ [Gradient]_VideoGameboyRamp ("Color Ramp", 2D) = "white" { }
+ [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Video ("Video", Float) = 0
+
+ [HideInInspector] m_start_TouchOptions ("Touch FX", Float) = 0
+ [HideInInspector] m_start_Bulge ("Bulge", Float) = 0
+ [Toggle(BLOOM_LOW)] _EnableBulge ("Bulge", Float) = 0
+ _BulgeMask ("Bulge Mask", 2D) = "white" { }
+ _BuldgeFadeLength ("Touch Distance", Float) = 0.02
+ _BuldgeHeight ("Bulge Height", Range(-0.2, 0.2)) = 0.02
+ [HideInInspector] m_end_Bulge ("Bulge", Float) = 0
+
+ [HideInInspector] m_start_TouchGlow ("Touch Color", Float) = 0
+ [Toggle(GRAIN)]_EnableTouchGlow ("Enable Touch Glow", Float) = 0
+ _DepthGlowColor ("Depth Glow Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DepthGradient ("Depth Gradient", 2D) = "white" { }
+ _DepthMask ("Depth Mask", 2D) = "white" { }
+ _DepthGlowEmission ("Depth Glow Emission", Float) = 3
+ _FadeLength ("Fade Length", Float) = 0.02
+ _DepthAlphaMin ("Alpha Min", Range(0, 1)) = 1
+ _DepthAlphaMax ("Alpha Max", Range(0, 1)) = 1
+ [HideInInspector] m_end_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchOptions ("Touch FX", Float) = 0
+
+ [HideInInspector] m_start_Hologram ("Hologram Alpha", Float) = 0
+ [Toggle(DEPTH_OF_FIELD)]_EnableHolo ("Enable Hologram Alpha", Float) = 0
+ [Curve]_HoloAlphaMap ("Alpha Map", 2D) = "white" { }
+ [Enum(World Space, 0, Local Space, 1, UV, 2)]_HoloCoordinateSpace ("Coordinate Space", Int) = 0
+ _HoloDirection ("Scroll Direction", Vector) = (0, 1, 0)
+ _HoloLineDensity ("Line Density", Float) = 10
+ _HoloScrollSpeed ("Scroll Speed", Float) = 1
+ [HideInInspector] m_start_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ _HoloFresnelAlpha ("Intensity", Range(0, 1)) = 0
+ _HoloRimSharpness ("Sharpness", Range(0, 1)) = .5
+ _HoloRimWidth ("Width", Range(0, 1)) = .5
+ [HideInInspector] m_end_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_Hologram ("Hologram Alpha", Float) = 0
+
+ [HideInInspector] m_start_wireframe ("Wireframe", Float) = 0
+ [ToggleUI]_WireframeEnable ("Enable Wireframe", Float) = 0
+ [ToggleUI]_WireframeQuad ("Quad", Float) = 0
+ _WireframeColor ("Wireframe Color", Color) = (1, 1, 1, 1)
+ _WireframeTexture ("Color Map", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _WireframeUV ("UV#", Int) = 0
+ [Vector2]_WireframeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ _WireframeEmissionStrength ("Emission Strength", Range(0, 30)) = 0
+ _WireframeThickness ("Thickness", Range(0, 20)) = 0
+ _WireframeEdgeOpacity ("Edge Opacity", Range(0, 1)) = 1
+ _WireframeFaceOpacity ("Face Opacity", Range(0, 1)) = .01
+ [HideInInspector] m_end_wireframe ("Wireframe", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence", Float) = 0
+ [Toggle(BLOOM_LENS_DIRT)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp", 2D) = "white" { }
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map", 2D) = "bump" { }
+ _IridescenceMask ("Mask", 2D) = "white" { }
+ _IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceNormalUV ("Normal UV", Int) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _IridescenceMaskUV ("Mask UV", Int) = 0
+ [Enum(vertex, 0, pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Enum(Run Early, 0, Run Late, 1)] _IridescenceTime ("When To Run", Int) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ [HideInInspector] m_start_VertexGlitch ("Vertex Glitching", Float) = 0
+ [ToggleUI]_EnableVertexGlitch ("Enable Vertex Glitching", Float) = 0
+ _VertexGlitchFrequency ("Glitch Interval", Float) = 0
+ _VertexGlitchThreshold ("Glitch Threshold", Range(0, 1)) = 1
+ _VertexGlitchStrength ("Glitch Strength", Range(0, 10)) = 1
+ [HideInInspector] m_end_VertexGlitch ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_Spawns ("Spawns", Float) = 0
+ [HideInInspector] m_start_ScifiSpawnIn ("Sci Fi", Float) = 0
+ [ToggleUI]_EnableScifiSpawnIn ("Enable Sci Fi Spawn", Float) = 0
+ _SpawnInNoise ("Spawn Noise", 2D) = "black" { }
+ _SpawnInNoiseIntensity ("Noise Intensity", Range(0, 1)) = .35
+ _SpawnInAlpha ("Spawn Alpha", Range(0, 1)) = 0
+ [Vector3]_SpawnInGradientStart ("Gradient Start", Vector) = (0, 2, 0)
+ [Vector3]_SpawnInGradientFinish ("Gradient End", Vector) = (0, -2, 0)
+ [HDR]_SpawnInEmissionColor ("Emission Color", Color) = (1, 1, 1)
+ _SpawnInEmissionOffset ("Emission Width", Range(0, 1)) = .1
+ _SpawnInVertOffset ("Vertex Offset Speed", Float) = 10
+ _SpawnInVertOffsetOffset ("vert width", Range(0, 1)) = .1
+ [HideInInspector] m_end_SciFiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_Spawns ("Spawns", Float) = 0
+
+ // Voronoi
+ [HideInInspector] m_start_Voronoi ("Vertex Glitching", Float) = 0
+ [Enum(2D(Fast), 0, 3D(Fast with color bugs), 1, 3D(slow but no bugs), 2)] _VoronoiType ("Space", Int) = 1
+ [Enum(Local, 0, World, 1, UV, 2)] _VoronoiSpace ("Space", Int) = 0
+ [Enum(Color and Emission, 0, Just Emission, 1)] _VoronoiBlend ("Blend", Int) = 0
+ [Toggle(CHROMATIC_ABERRATION)]_EnableVoronoi ("Enable Voronoi", Float) = 0
+ _VoronoiMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_VoronoiMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiMaskUV ("UV", Int) = 0
+ _VoronoiNoise ("Edge Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_VoronoiNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _VoronoiNoiseUV ("UV", Int) = 0
+ _VoronoiNoiseIntensity ("Noise Intensity", Range(0, 1)) = .1
+ _VoronoiColor0 ("Color 0", Color) = (0, 0, 0, 1)
+ _VoronoiEmission0 ("Emission 0", Range(0, 20)) = 0
+ _VoronoiColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ _VoronoiEmission1 ("Emission 1", Range(0, 20)) = 0
+ [Vector2]_VoronoiGradient ("Gradient", Vector) = (.04, .05, 0, 0)
+ _VoronoiScale ("Scale", Float) = 5
+ [Vector3]_VoronoiSpeed ("Speed", Vector) = (3, 3, 3)
+ [HideInInspector] m_start_voronoiRandom ("Voronoi Random Cell Color", Float) = 0
+ [ToggleUI]_VoronoiEnableRandomCellColor ("Rando Cell Col", Float) = 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_end_Voronoi ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_BlackLight ("Black Light Mask", Float) = 0
+ [HideInInspector][Toggle(_SPECULARHIGHLIGHTS_OFF)]_BlackLightMaskEnabled ("Black Light Mask Enabled", Float) = 0
+ _BlackLightMaskKeys ("Mask Keys", Vector) = (2, 3, 4, 5)
+ _BlackLightMaskStart ("Gradient Start", Vector) = (0, 0, 0, 0)
+ _BlackLightMaskEnd ("Gradient End", Vector) = (1, 1, 1, 1)
+ [ToggleUI]_BlackLightMaskDebug ("Visualize", Float) = 0
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMetallic ("Metallic", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskClearCoat ("Clear Coat", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap ("Matcap 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap2 ("Matcap 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission ("Emission 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission2 ("Emission 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskFlipbook ("Flipbook", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskDissolve ("Dissolve", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskPanosphere ("Panosphere", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskGlitter ("Glitter", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskIridescence ("Iridescence", Int) = 4
+ [HideInInspector] m_end_BlackLight ("Black Light", Float) = 0
+ // End Patreon
+
+ // Parallax Mapping
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [Toggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ [Vector2]_ParallaxHeightMapPan ("Pan", Vector) = (0, 0, 0, 0)
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ParallaxUV ("Parallax UV", Int) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxHeightMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxHeightMapMaskUV ("UV", Int) = 0
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxInternalMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _ParallaxInternalMapMaskUV ("UV", Int) = 0
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+ [HideInInspector] m_start_parallaxAdvanced ("Advanced", Float) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxAdvanced ("Advanced", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 0
+ _ZBias ("ZBias", Float) = 0.0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Debug Options
+ [HideInInspector] m_start_debugOptions ("Debug", Float) = 0
+ [HideInInspector][Toggle(_COLOROVERLAY_ON)]_DebugEnabled ("Display Debug Info", Float) = 0
+ _VertexUnwrap ("Unwrap", Range(0, 1)) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ [HideInInspector] m_end_debugOptions ("Debug", Float) = 0
+ }
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ //Blend SrcAlpha OneMinusSrcAlpha
+ Blend [_SourceBlend] [_DestinationBlend]
+ Tags { "Queue" = "Transparent+10" "RenderType" = "Transparent" }
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define WIREFRAME
+ #define FORWARD_BASE_PASS
+ // Base Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // patreon Base
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Touch Color
+ #pragma shader_feature GRAIN
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma geometry wireframeGeom
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define WIREFRAME
+ #define FORWARD_ADD_PASS
+ // Add Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma geometry wireframeGeom
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ CGPROGRAM
+
+ #pragma target 4.0
+ #define TRANSPARENT
+ #define POI_SHADOW
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/CGI_PoiPassShadow.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+ Cull Off
+ CGPROGRAM
+
+ #define POI_META_PASS
+ #define TRANSPARENT
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature LOD_FADE_CROSSFADE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature FXAA
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ #pragma shader_feature _EMISSION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ }
+ Fallback "Toon/Lit Cutout (Double)"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT.shader.meta
new file mode 100644
index 00000000..512ef2bd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT.shader.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 115fc66893455e64da88cab6aeeb16ae
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_label b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_label
new file mode 100644
index 00000000..d9dbd4dd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_label
@@ -0,0 +1,602 @@
+m_mainOptions:=locale::m_mainOptions_text--{tooltip:locale::m_mainOptions_tooltip}
+m_start_RGBMask:=locale::m_start_RGBMask_text--{tooltip:locale::m_start_RGBMask_tooltip}
+m_end_RGBMask:=locale::m_end_RGBMask_text--{tooltip:locale::m_end_RGBMask_tooltip}
+m_start_DetailOptions:=locale::m_start_DetailOptions_text--{tooltip:locale::m_start_DetailOptions_tooltip}
+m_end_DetailOptions:=locale::m_end_DetailOptions_text--{tooltip:locale::m_end_DetailOptions_tooltip}
+m_start_vertexManipulation:=locale::m_start_vertexManipulation_text--{tooltip:locale::m_start_vertexManipulation_tooltip}
+m_end_vertexManipulation:=locale::m_end_vertexManipulation_text--{tooltip:locale::m_end_vertexManipulation_tooltip}
+m_start_Alpha:=locale::m_start_Alpha_text--{tooltip:locale::m_start_Alpha_tooltip}
+m_end_Alpha:=locale::m_end_Alpha_text--{tooltip:locale::m_end_Alpha_tooltip}
+m_start_backFace:=locale::m_start_backFace_text--{tooltip:locale::m_start_backFace_tooltip}
+m_end_backFace:=locale::m_end_backFace_text--{tooltip:locale::m_end_backFace_tooltip}
+m_lightingOptions:=locale::m_lightingOptions_text--{tooltip:locale::m_lightingOptions_tooltip}
+m_start_Lighting:=locale::m_start_Lighting_text--{tooltip:locale::m_start_Lighting_tooltip}
+m_start_lightingStandard:=locale::m_start_lightingStandard_text--{tooltip:locale::m_start_lightingStandard_tooltip}
+m_end_lightingStandard:=locale::m_end_lightingStandard_text--{tooltip:locale::m_end_lightingStandard_tooltip}
+m_start_lightingAdvanced:=locale::m_start_lightingAdvanced_text--{tooltip:locale::m_start_lightingAdvanced_tooltip}
+m_end_lightingAdvanced:=locale::m_end_lightingAdvanced_text--{tooltip:locale::m_end_lightingAdvanced_tooltip}
+m_start_lightingBeta:=locale::m_start_lightingBeta_text--{tooltip:locale::m_start_lightingBeta_tooltip}
+m_end_lightingBeta:=locale::m_end_lightingBeta_text--{tooltip:locale::m_end_lightingBeta_tooltip}
+m_end_Lighting:=locale::m_end_Lighting_text--{tooltip:locale::m_end_Lighting_tooltip}
+m_start_subsurface:=locale::m_start_subsurface_text--{tooltip:locale::m_start_subsurface_tooltip}
+m_end_subsurface:=locale::m_end_subsurface_text--{tooltip:locale::m_end_subsurface_tooltip}
+m_start_rimLightOptions:=locale::m_start_rimLightOptions_text--{tooltip:locale::m_start_rimLightOptions_tooltip}
+m_start_rimWidthNoise:=locale::m_start_rimWidthNoise_text--{tooltip:locale::m_start_rimWidthNoise_tooltip}
+m_end_rimWidthNoise:=locale::m_end_rimWidthNoise_text--{tooltip:locale::m_end_rimWidthNoise_tooltip}
+m_start_ShadowMix:=locale::m_start_ShadowMix_text--{tooltip:locale::m_start_ShadowMix_tooltip}
+m_end_ShadowMix:=locale::m_end_ShadowMix_text--{tooltip:locale::m_end_ShadowMix_tooltip}
+m_end_rimLightOptions:=locale::m_end_rimLightOptions_text--{tooltip:locale::m_end_rimLightOptions_tooltip}
+m_start_reflectionRim:=locale::m_start_reflectionRim_text--{tooltip:locale::m_start_reflectionRim_tooltip}
+m_end_reflectionRim:=locale::m_end_reflectionRim_text--{tooltip:locale::m_end_reflectionRim_tooltip}
+m_start_bakedLighting:=locale::m_start_bakedLighting_text--{tooltip:locale::m_start_bakedLighting_tooltip}
+m_end_bakedLighting:=locale::m_end_bakedLighting_text--{tooltip:locale::m_end_bakedLighting_tooltip}
+m_reflectionOptions:=locale::m_reflectionOptions_text--{tooltip:locale::m_reflectionOptions_tooltip}
+m_start_Metallic:=locale::m_start_Metallic_text--{tooltip:locale::m_start_Metallic_tooltip}
+m_end_Metallic:=locale::m_end_Metallic_text--{tooltip:locale::m_end_Metallic_tooltip}
+m_start_clearCoat:=locale::m_start_clearCoat_text--{tooltip:locale::m_start_clearCoat_tooltip}
+m_end_clearCoat:=locale::m_end_clearCoat_text--{tooltip:locale::m_end_clearCoat_tooltip}
+m_start_matcap:=locale::m_start_matcap_text--{tooltip:locale::m_start_matcap_tooltip}
+m_end_matcap:=locale::m_end_matcap_text--{tooltip:locale::m_end_matcap_tooltip}
+m_start_Matcap2:=locale::m_start_Matcap2_text--{tooltip:locale::m_start_Matcap2_tooltip}
+m_end_Matcap2:=locale::m_end_Matcap2_text--{tooltip:locale::m_end_Matcap2_tooltip}
+m_start_specular:=locale::m_start_specular_text--{tooltip:locale::m_start_specular_tooltip}
+m_start_SpecularToon:=locale::m_start_SpecularToon_text--{tooltip:locale::m_start_SpecularToon_tooltip}
+m_end_SpecularToon:=locale::m_end_SpecularToon_text--{tooltip:locale::m_end_SpecularToon_tooltip}
+m_start_Anisotropic:=locale::m_start_Anisotropic_text--{tooltip:locale::m_start_Anisotropic_tooltip}
+m_end_Anisotropic:=locale::m_end_Anisotropic_text--{tooltip:locale::m_end_Anisotropic_tooltip}
+m_end_specular:=locale::m_end_specular_text--{tooltip:locale::m_end_specular_tooltip}
+m_start_specular1:=locale::m_start_specular1_text--{tooltip:locale::m_start_specular1_tooltip}
+m_start_SpecularToon1:=locale::m_start_SpecularToon1_text--{tooltip:locale::m_start_SpecularToon1_tooltip}
+m_end_SpecularToon1:=locale::m_end_SpecularToon1_text--{tooltip:locale::m_end_SpecularToon1_tooltip}
+m_start_Anisotropic1:=locale::m_start_Anisotropic1_text--{tooltip:locale::m_start_Anisotropic1_tooltip}
+m_end_Anisotropic1:=locale::m_end_Anisotropic1_text--{tooltip:locale::m_end_Anisotropic1_tooltip}
+m_end_specular1:=locale::m_end_specular1_text--{tooltip:locale::m_end_specular1_tooltip}
+m_Special_Effects:=locale::m_Special_Effects_text--{tooltip:locale::m_Special_Effects_tooltip}
+m_start_emissionOptions:=locale::m_start_emissionOptions_text--{tooltip:locale::m_start_emissionOptions_tooltip}
+m_start_CenterOutEmission:=locale::m_start_CenterOutEmission_text--{tooltip:locale::m_start_CenterOutEmission_tooltip}
+m_end_CenterOutEmission:=locale::m_end_CenterOutEmission_text--{tooltip:locale::m_end_CenterOutEmission_tooltip}
+m_start_glowInDarkEmissionOptions:=locale::m_start_glowInDarkEmissionOptions_text--{tooltip:locale::m_start_glowInDarkEmissionOptions_tooltip}
+m_end_glowInDarkEmissionOptions:=locale::m_end_glowInDarkEmissionOptions_text--{tooltip:locale::m_end_glowInDarkEmissionOptions_tooltip}
+m_start_blinkingEmissionOptions:=locale::m_start_blinkingEmissionOptions_text--{tooltip:locale::m_start_blinkingEmissionOptions_tooltip}
+m_end_blinkingEmissionOptions:=locale::m_end_blinkingEmissionOptions_text--{tooltip:locale::m_end_blinkingEmissionOptions_tooltip}
+m_start_scrollingEmissionOptions:=locale::m_start_scrollingEmissionOptions_text--{tooltip:locale::m_start_scrollingEmissionOptions_tooltip}
+m_end_scrollingEmissionOptions:=locale::m_end_scrollingEmissionOptions_text--{tooltip:locale::m_end_scrollingEmissionOptions_tooltip}
+m_end_emissionOptions:=locale::m_end_emissionOptions_text--{tooltip:locale::m_end_emissionOptions_tooltip}
+m_start_emission1Options:=locale::m_start_emission1Options_text--{tooltip:locale::m_start_emission1Options_tooltip}
+m_start_CenterOutEmission1:=locale::m_start_CenterOutEmission1_text--{tooltip:locale::m_start_CenterOutEmission1_tooltip}
+m_end_CenterOutEmission1:=locale::m_end_CenterOutEmission1_text--{tooltip:locale::m_end_CenterOutEmission1_tooltip}
+m_start_glowInDarkEmissionOptions1:=locale::m_start_glowInDarkEmissionOptions1_text--{tooltip:locale::m_start_glowInDarkEmissionOptions1_tooltip}
+m_end_glowInDarkEmissionOptions1:=locale::m_end_glowInDarkEmissionOptions1_text--{tooltip:locale::m_end_glowInDarkEmissionOptions1_tooltip}
+m_start_blinkingEmissionOptions1:=locale::m_start_blinkingEmissionOptions1_text--{tooltip:locale::m_start_blinkingEmissionOptions1_tooltip}
+m_end_blinkingEmissionOptions1:=locale::m_end_blinkingEmissionOptions1_text--{tooltip:locale::m_end_blinkingEmissionOptions1_tooltip}
+m_start_scrollingEmissionOptions1:=locale::m_start_scrollingEmissionOptions1_text--{tooltip:locale::m_start_scrollingEmissionOptions1_tooltip}
+m_end_scrollingEmission1Options:=locale::m_end_scrollingEmission1Options_text--{tooltip:locale::m_end_scrollingEmission1Options_tooltip}
+m_end_emission1Options:=locale::m_end_emission1Options_text--{tooltip:locale::m_end_emission1Options_tooltip}
+m_start_flipBook:=locale::m_start_flipBook_text--{tooltip:locale::m_start_flipBook_tooltip}
+m_start_manualFlipbookControl:=locale::m_start_manualFlipbookControl_text--{tooltip:locale::m_start_manualFlipbookControl_tooltip}
+m_end_manualFlipbookControl:=locale::m_end_manualFlipbookControl_text--{tooltip:locale::m_end_manualFlipbookControl_tooltip}
+m_end_flipBook:=locale::m_end_flipBook_text--{tooltip:locale::m_end_flipBook_tooltip}
+m_start_dissolve:=locale::m_start_dissolve_text--{tooltip:locale::m_start_dissolve_tooltip}
+m_start_pointToPoint:=locale::m_start_pointToPoint_text--{tooltip:locale::m_start_pointToPoint_tooltip}
+m_end_pointToPoint:=locale::m_end_pointToPoint_text--{tooltip:locale::m_end_pointToPoint_tooltip}
+m_end_dissolve:=locale::m_end_dissolve_text--{tooltip:locale::m_end_dissolve_tooltip}
+m_start_panosphereOptions:=locale::m_start_panosphereOptions_text--{tooltip:locale::m_start_panosphereOptions_tooltip}
+m_end_panosphereOptions:=locale::m_end_panosphereOptions_text--{tooltip:locale::m_end_panosphereOptions_tooltip}
+m_start_glitter:=locale::m_start_glitter_text--{tooltip:locale::m_start_glitter_tooltip}
+m_end_glitter:=locale::m_end_glitter_text--{tooltip:locale::m_end_glitter_tooltip}
+m_start_Text:=locale::m_start_Text_text--{tooltip:locale::m_start_Text_tooltip}
+m_start_TextFPS:=locale::m_start_TextFPS_text--{tooltip:locale::m_start_TextFPS_tooltip}
+m_end_TextFPS:=locale::m_end_TextFPS_text--{tooltip:locale::m_end_TextFPS_tooltip}
+m_start_TextPosition:=locale::m_start_TextPosition_text--{tooltip:locale::m_start_TextPosition_tooltip}
+m_end_TextPosition:=locale::m_end_TextPosition_text--{tooltip:locale::m_end_TextPosition_tooltip}
+m_start_TextInstanceTime:=locale::m_start_TextInstanceTime_text--{tooltip:locale::m_start_TextInstanceTime_tooltip}
+m_end_TextInstanceTime:=locale::m_end_TextInstanceTime_text--{tooltip:locale::m_end_TextInstanceTime_tooltip}
+m_end_Text:=locale::m_end_Text_text--{tooltip:locale::m_end_Text_tooltip}
+m_start_mirrorOptions:=locale::m_start_mirrorOptions_text--{tooltip:locale::m_start_mirrorOptions_tooltip}
+m_end_mirrorOptions:=locale::m_end_mirrorOptions_text--{tooltip:locale::m_end_mirrorOptions_tooltip}
+m_start_distanceFade:=locale::m_start_distanceFade_text--{tooltip:locale::m_start_distanceFade_tooltip}
+m_end_Fade:=locale::m_end_Fade_text--{tooltip:locale::m_end_Fade_tooltip}
+m_start_angularFade:=locale::m_start_angularFade_text--{tooltip:locale::m_start_angularFade_tooltip}
+m_end_angularFade:=locale::m_end_angularFade_text--{tooltip:locale::m_end_angularFade_tooltip}
+m_start_distanceDithering:=locale::m_start_distanceDithering_text--{tooltip:locale::m_start_distanceDithering_tooltip}
+m_end_distanceDithering:=locale::m_end_distanceDithering_text--{tooltip:locale::m_end_distanceDithering_tooltip}
+m_start_distortionFlow:=locale::m_start_distortionFlow_text--{tooltip:locale::m_start_distortionFlow_tooltip}
+m_end_distortionFlow:=locale::m_end_distortionFlow_text--{tooltip:locale::m_end_distortionFlow_tooltip}
+m_Patreon:=locale::m_Patreon_text--{tooltip:locale::m_Patreon_tooltip}
+m_start_Video:=locale::m_start_Video_text--{tooltip:locale::m_start_Video_tooltip}
+m_start_VideoSettings:=locale::m_start_VideoSettings_text--{tooltip:locale::m_start_VideoSettings_tooltip}
+m_end_VideoSettings:=locale::m_end_VideoSettings_text--{tooltip:locale::m_end_VideoSettings_tooltip}
+m_start_VideoDebug:=locale::m_start_VideoDebug_text--{tooltip:locale::m_start_VideoDebug_tooltip}
+m_end_VideoDebug:=locale::m_end_VideoDebug_text--{tooltip:locale::m_end_VideoDebug_tooltip}
+m_start_CRT:=locale::m_start_CRT_text--{tooltip:locale::m_start_CRT_tooltip}
+m_end_CRT:=locale::m_end_CRT_text--{tooltip:locale::m_end_CRT_tooltip}
+m_start_Gameboy:=locale::m_start_Gameboy_text--{tooltip:locale::m_start_Gameboy_tooltip}
+m_end_Gameboy:=locale::m_end_Gameboy_text--{tooltip:locale::m_end_Gameboy_tooltip}
+m_end_Video:=locale::m_end_Video_text--{tooltip:locale::m_end_Video_tooltip}
+m_start_TouchOptions:=locale::m_start_TouchOptions_text--{tooltip:locale::m_start_TouchOptions_tooltip}
+m_start_Bulge:=locale::m_start_Bulge_text--{tooltip:locale::m_start_Bulge_tooltip}
+m_end_Bulge:=locale::m_end_Bulge_text--{tooltip:locale::m_end_Bulge_tooltip}
+m_start_TouchGlow:=locale::m_start_TouchGlow_text--{tooltip:locale::m_start_TouchGlow_tooltip}
+m_end_TouchGlow:=locale::m_end_TouchGlow_text--{tooltip:locale::m_end_TouchGlow_tooltip}
+m_end_TouchOptions:=locale::m_end_TouchOptions_text--{tooltip:locale::m_end_TouchOptions_tooltip}
+m_start_Hologram:=locale::m_start_Hologram_text--{tooltip:locale::m_start_Hologram_tooltip}
+m_start_FresnelAlpha:=locale::m_start_FresnelAlpha_text--{tooltip:locale::m_start_FresnelAlpha_tooltip}
+m_end_FresnelAlpha:=locale::m_end_FresnelAlpha_text--{tooltip:locale::m_end_FresnelAlpha_tooltip}
+m_end_Hologram:=locale::m_end_Hologram_text--{tooltip:locale::m_end_Hologram_tooltip}
+m_start_wireframe:=locale::m_start_wireframe_text--{tooltip:locale::m_start_wireframe_tooltip}
+m_end_wireframe:=locale::m_end_wireframe_text--{tooltip:locale::m_end_wireframe_tooltip}
+m_ParallaxMap:=locale::m_ParallaxMap_text--{tooltip:locale::m_ParallaxMap_tooltip}
+m_start_parallaxHeightmap:=locale::m_start_parallaxHeightmap_text--{tooltip:locale::m_start_parallaxHeightmap_tooltip}
+m_end_parallaxHeightmap:=locale::m_end_parallaxHeightmap_text--{tooltip:locale::m_end_parallaxHeightmap_tooltip}
+m_start_parallaxInternal:=locale::m_start_parallaxInternal_text--{tooltip:locale::m_start_parallaxInternal_tooltip}
+m_end_parallaxInternal:=locale::m_end_parallaxInternal_text--{tooltip:locale::m_end_parallaxInternal_tooltip}
+m_start_parallaxAdvanced:=locale::m_start_parallaxAdvanced_text--{tooltip:locale::m_start_parallaxAdvanced_tooltip}
+m_end_parallaxAdvanced:=locale::m_end_parallaxAdvanced_text--{tooltip:locale::m_end_parallaxAdvanced_tooltip}
+m_renderingOptions:=locale::m_renderingOptions_text--{tooltip:locale::m_renderingOptions_tooltip}
+m_start_StencilPassOptions:=locale::m_start_StencilPassOptions_text--{tooltip:locale::m_start_StencilPassOptions_tooltip}
+m_end_StencilPassOptions:=locale::m_end_StencilPassOptions_text--{tooltip:locale::m_end_StencilPassOptions_tooltip}
+m_start_debugOptions:=locale::m_start_debugOptions_text--{tooltip:locale::m_start_debugOptions_tooltip}
+m_end_debugOptions:=locale::m_end_debugOptions_text--{tooltip:locale::m_end_debugOptions_tooltip}
+shader_is_using_thry_editor:=locale::shader_is_using_thry_editor_text--{tooltip:locale::shader_is_using_thry_editor_tooltip}
+shader_master_label:=locale::shader_master_label_text--{tooltip:locale::shader_master_label_tooltip}
+shader_presets:=locale::shader_presets_text--{tooltip:locale::shader_presets_tooltip}
+shader_properties_label_file:=locale::shader_properties_label_file_text--{tooltip:locale::shader_properties_label_file_tooltip}
+footer_youtube:=locale::footer_youtube_text--{tooltip:locale::footer_youtube_tooltip}
+footer_twitter:=locale::footer_twitter_text--{tooltip:locale::footer_twitter_tooltip}
+footer_patreon:=locale::footer_patreon_text--{tooltip:locale::footer_patreon_tooltip}
+footer_discord:=locale::footer_discord_text--{tooltip:locale::footer_discord_tooltip}
+footer_github:=locale::footer_github_text--{tooltip:locale::footer_github_tooltip}
+_Color:=locale::_Color_text--{tooltip:locale::_Color_tooltip}
+_Saturation:=locale::_Saturation_text--{tooltip:locale::_Saturation_tooltip}
+_MainVertexColoring:=locale::_MainVertexColoring_text--{tooltip:locale::_MainVertexColoring_tooltip}
+_MainEmissionStrength:=locale::_MainEmissionStrength_text--{tooltip:locale::_MainEmissionStrength_tooltip}
+_MainTex:=locale::_MainTex_text--{tooltip:locale::_MainTex_tooltip}
+_MainTextureUV:=locale::_MainTextureUV_text--{tooltip:locale::_MainTextureUV_tooltip}
+_MainHueShift:=locale::_MainHueShift_text--{tooltip:locale::_MainHueShift_tooltip}
+_BumpMap:=locale::_BumpMap_text--{tooltip:locale::_BumpMap_tooltip}
+_BumpMapUV:=locale::_BumpMapUV_text--{tooltip:locale::_BumpMapUV_tooltip}
+_BumpMapPan:=locale::_BumpMapPan_text--{tooltip:locale::_BumpMapPan_tooltip}
+_BumpScale:=locale::_BumpScale_text--{tooltip:locale::_BumpScale_tooltip}
+_AlphaMask:=locale::_AlphaMask_text--{tooltip:locale::_AlphaMask_tooltip}
+_GlobalPanSpeed:=locale::_GlobalPanSpeed_text--{tooltip:locale::_GlobalPanSpeed_tooltip}
+_RGBMaskEnabled:=locale::_RGBMaskEnabled_text--{tooltip:locale::_RGBMaskEnabled_tooltip}
+_RGBMask:=locale::_RGBMask_text--{tooltip:locale::_RGBMask_tooltip}
+_RGBMaskUV:=locale::_RGBMaskUV_text--{tooltip:locale::_RGBMaskUV_tooltip}
+_RedColor:=locale::_RedColor_text--{tooltip:locale::_RedColor_tooltip}
+_RedTexure:=locale::_RedTexure_text--{tooltip:locale::_RedTexure_tooltip}
+_RGBRed_UV:=locale::_RGBRed_UV_text--{tooltip:locale::_RGBRed_UV_tooltip}
+_GreenColor:=locale::_GreenColor_text--{tooltip:locale::_GreenColor_tooltip}
+_GreenTexture:=locale::_GreenTexture_text--{tooltip:locale::_GreenTexture_tooltip}
+_RGBGreen_UV:=locale::_RGBGreen_UV_text--{tooltip:locale::_RGBGreen_UV_tooltip}
+_BlueColor:=locale::_BlueColor_text--{tooltip:locale::_BlueColor_tooltip}
+_BlueTexture:=locale::_BlueTexture_text--{tooltip:locale::_BlueTexture_tooltip}
+_RGBBlue_UV:=locale::_RGBBlue_UV_text--{tooltip:locale::_RGBBlue_UV_tooltip}
+_DetailMask:=locale::_DetailMask_text--{tooltip:locale::_DetailMask_tooltip}
+_DetailTex:=locale::_DetailTex_text--{tooltip:locale::_DetailTex_tooltip}
+_DetailTexPan:=locale::_DetailTexPan_text--{tooltip:locale::_DetailTexPan_tooltip}
+_DetailTexUV:=locale::_DetailTexUV_text--{tooltip:locale::_DetailTexUV_tooltip}
+_DetailTexIntensity:=locale::_DetailTexIntensity_text--{tooltip:locale::_DetailTexIntensity_tooltip}
+_DetailBrightness:=locale::_DetailBrightness_text--{tooltip:locale::_DetailBrightness_tooltip}
+_DetailTint:=locale::_DetailTint_text--{tooltip:locale::_DetailTint_tooltip}
+_DetailNormalMap:=locale::_DetailNormalMap_text--{tooltip:locale::_DetailNormalMap_tooltip}
+_DetailNormalMapUV:=locale::_DetailNormalMapUV_text--{tooltip:locale::_DetailNormalMapUV_tooltip}
+_DetailNormalMapScale:=locale::_DetailNormalMapScale_text--{tooltip:locale::_DetailNormalMapScale_tooltip}
+_DetailNormalMapPan:=locale::_DetailNormalMapPan_text--{tooltip:locale::_DetailNormalMapPan_tooltip}
+_VertexManipulationLocalTranslation:=locale::_VertexManipulationLocalTranslation_text--{tooltip:locale::_VertexManipulationLocalTranslation_tooltip}
+_VertexManipulationLocalRotation:=locale::_VertexManipulationLocalRotation_text--{tooltip:locale::_VertexManipulationLocalRotation_tooltip}
+_VertexManipulationLocalScale:=locale::_VertexManipulationLocalScale_text--{tooltip:locale::_VertexManipulationLocalScale_tooltip}
+_VertexManipulationWorldTranslation:=locale::_VertexManipulationWorldTranslation_text--{tooltip:locale::_VertexManipulationWorldTranslation_tooltip}
+_VertexManipulationHeight:=locale::_VertexManipulationHeight_text--{tooltip:locale::_VertexManipulationHeight_tooltip}
+_VertexManipulationHeightUV:=locale::_VertexManipulationHeightUV_text--{tooltip:locale::_VertexManipulationHeightUV_tooltip}
+_VertexManipulationHeightMask:=locale::_VertexManipulationHeightMask_text--{tooltip:locale::_VertexManipulationHeightMask_tooltip}
+_VertexManipulationHeightBias:=locale::_VertexManipulationHeightBias_text--{tooltip:locale::_VertexManipulationHeightBias_tooltip}
+_VertexManipulationHeightPan:=locale::_VertexManipulationHeightPan_text--{tooltip:locale::_VertexManipulationHeightPan_tooltip}
+_Clip:=locale::_Clip_text--{tooltip:locale::_Clip_tooltip}
+_DitheringEnabled:=locale::_DitheringEnabled_text--{tooltip:locale::_DitheringEnabled_tooltip}
+_ForceOpaque:=locale::_ForceOpaque_text--{tooltip:locale::_ForceOpaque_tooltip}
+_MainAlphaToCoverage:=locale::_MainAlphaToCoverage_text--{tooltip:locale::_MainAlphaToCoverage_tooltip}
+_MainShadowClipMod:=locale::_MainShadowClipMod_text--{tooltip:locale::_MainShadowClipMod_tooltip}
+_MainMipScale:=locale::_MainMipScale_text--{tooltip:locale::_MainMipScale_tooltip}
+_BackFaceEnabled:=locale::_BackFaceEnabled_text--{tooltip:locale::_BackFaceEnabled_tooltip}
+_BackFaceTextureUV:=locale::_BackFaceTextureUV_text--{tooltip:locale::_BackFaceTextureUV_tooltip}
+_BackFaceTexture:=locale::_BackFaceTexture_text--{tooltip:locale::_BackFaceTexture_tooltip}
+_BackFacePanning:=locale::_BackFacePanning_text--{tooltip:locale::_BackFacePanning_tooltip}
+_BackFaceDetailIntensity:=locale::_BackFaceDetailIntensity_text--{tooltip:locale::_BackFaceDetailIntensity_tooltip}
+_BackFaceHueShift:=locale::_BackFaceHueShift_text--{tooltip:locale::_BackFaceHueShift_tooltip}
+_BackFaceEmissionStrength:=locale::_BackFaceEmissionStrength_text--{tooltip:locale::_BackFaceEmissionStrength_tooltip}
+_EnableLighting:=locale::_EnableLighting_text--{tooltip:locale::_EnableLighting_tooltip}
+_LightingType:=locale::_LightingType_text--{tooltip:locale::_LightingType_tooltip}
+_ToonRamp:=locale::_ToonRamp_text--{tooltip:locale::_ToonRamp_tooltip}
+_LightingShadowMask:=locale::_LightingShadowMask_text--{tooltip:locale::_LightingShadowMask_tooltip}
+_ShadowStrength:=locale::_ShadowStrength_text--{tooltip:locale::_ShadowStrength_tooltip}
+_ShadowOffset:=locale::_ShadowOffset_text--{tooltip:locale::_ShadowOffset_tooltip}
+_LightingAOTex:=locale::_LightingAOTex_text--{tooltip:locale::_LightingAOTex_tooltip}
+_LightingAOTexUV:=locale::_LightingAOTexUV_text--{tooltip:locale::_LightingAOTexUV_tooltip}
+_AoIndirectStrength:=locale::_AoIndirectStrength_text--{tooltip:locale::_AoIndirectStrength_tooltip}
+_AOStrength:=locale::_AOStrength_text--{tooltip:locale::_AOStrength_tooltip}
+_LightingMinLightBrightness:=locale::_LightingMinLightBrightness_text--{tooltip:locale::_LightingMinLightBrightness_tooltip}
+_LightingIndirectContribution:=locale::_LightingIndirectContribution_text--{tooltip:locale::_LightingIndirectContribution_tooltip}
+_AttenuationMultiplier:=locale::_AttenuationMultiplier_text--{tooltip:locale::_AttenuationMultiplier_tooltip}
+_LightingStandardSmoothness:=locale::_LightingStandardSmoothness_text--{tooltip:locale::_LightingStandardSmoothness_tooltip}
+_AdditiveSoftness:=locale::_AdditiveSoftness_text--{tooltip:locale::_AdditiveSoftness_tooltip}
+_AdditiveOffset:=locale::_AdditiveOffset_text--{tooltip:locale::_AdditiveOffset_tooltip}
+_LightingAdditiveIntensity:=locale::_LightingAdditiveIntensity_text--{tooltip:locale::_LightingAdditiveIntensity_tooltip}
+_LightingStandardControlsToon:=locale::_LightingStandardControlsToon_text--{tooltip:locale::_LightingStandardControlsToon_tooltip}
+_LightingNumRamps:=locale::_LightingNumRamps_text--{tooltip:locale::_LightingNumRamps_tooltip}
+_ToonRamp1:=locale::_ToonRamp1_text--{tooltip:locale::_ToonRamp1_tooltip}
+_LightingShadowStrength1:=locale::_LightingShadowStrength1_text--{tooltip:locale::_LightingShadowStrength1_tooltip}
+_ShadowOffset1:=locale::_ShadowOffset1_text--{tooltip:locale::_ShadowOffset1_tooltip}
+_ToonRamp2:=locale::_ToonRamp2_text--{tooltip:locale::_ToonRamp2_tooltip}
+_LightingShadowStrength2:=locale::_LightingShadowStrength2_text--{tooltip:locale::_LightingShadowStrength2_tooltip}
+_ShadowOffset2:=locale::_ShadowOffset2_text--{tooltip:locale::_ShadowOffset2_tooltip}
+_EnableSSS:=locale::_EnableSSS_text--{tooltip:locale::_EnableSSS_tooltip}
+_SSSColor:=locale::_SSSColor_text--{tooltip:locale::_SSSColor_tooltip}
+_SSSColorMap:=locale::_SSSColorMap_text--{tooltip:locale::_SSSColorMap_tooltip}
+_SSSThicknessMap:=locale::_SSSThicknessMap_text--{tooltip:locale::_SSSThicknessMap_tooltip}
+_SSSThicknessMod:=locale::_SSSThicknessMod_text--{tooltip:locale::_SSSThicknessMod_tooltip}
+_SSSStrength:=locale::_SSSStrength_text--{tooltip:locale::_SSSStrength_tooltip}
+_SSSPower:=locale::_SSSPower_text--{tooltip:locale::_SSSPower_tooltip}
+_SSSDistortion:=locale::_SSSDistortion_text--{tooltip:locale::_SSSDistortion_tooltip}
+_SSSNormal:=locale::_SSSNormal_text--{tooltip:locale::_SSSNormal_tooltip}
+_EnableRimLighting:=locale::_EnableRimLighting_text--{tooltip:locale::_EnableRimLighting_tooltip}
+_RimLightNormal:=locale::_RimLightNormal_text--{tooltip:locale::_RimLightNormal_tooltip}
+_RimLightingInvert:=locale::_RimLightingInvert_text--{tooltip:locale::_RimLightingInvert_tooltip}
+_RimLightColor:=locale::_RimLightColor_text--{tooltip:locale::_RimLightColor_tooltip}
+_RimWidth:=locale::_RimWidth_text--{tooltip:locale::_RimWidth_tooltip}
+_RimSharpness:=locale::_RimSharpness_text--{tooltip:locale::_RimSharpness_tooltip}
+_RimStrength:=locale::_RimStrength_text--{tooltip:locale::_RimStrength_tooltip}
+_RimBrighten:=locale::_RimBrighten_text--{tooltip:locale::_RimBrighten_tooltip}
+_RimLightColorBias:=locale::_RimLightColorBias_text--{tooltip:locale::_RimLightColorBias_tooltip}
+_RimTex:=locale::_RimTex_text--{tooltip:locale::_RimTex_tooltip}
+_RimMask:=locale::_RimMask_text--{tooltip:locale::_RimMask_tooltip}
+_RimTexPan:=locale::_RimTexPan_text--{tooltip:locale::_RimTexPan_tooltip}
+_RimWidthNoiseTexture:=locale::_RimWidthNoiseTexture_text--{tooltip:locale::_RimWidthNoiseTexture_tooltip}
+_RimWidthNoiseStrength:=locale::_RimWidthNoiseStrength_text--{tooltip:locale::_RimWidthNoiseStrength_tooltip}
+_RimWidthNoisePan:=locale::_RimWidthNoisePan_text--{tooltip:locale::_RimWidthNoisePan_tooltip}
+_ShadowMix:=locale::_ShadowMix_text--{tooltip:locale::_ShadowMix_tooltip}
+_ShadowMixThreshold:=locale::_ShadowMixThreshold_text--{tooltip:locale::_ShadowMixThreshold_tooltip}
+_ShadowMixWidthMod:=locale::_ShadowMixWidthMod_text--{tooltip:locale::_ShadowMixWidthMod_tooltip}
+_EnableEnvironmentalRim:=locale::_EnableEnvironmentalRim_text--{tooltip:locale::_EnableEnvironmentalRim_tooltip}
+_RimEnviroMask:=locale::_RimEnviroMask_text--{tooltip:locale::_RimEnviroMask_tooltip}
+_RimEnviroBlur:=locale::_RimEnviroBlur_text--{tooltip:locale::_RimEnviroBlur_tooltip}
+_RimEnviroWidth:=locale::_RimEnviroWidth_text--{tooltip:locale::_RimEnviroWidth_tooltip}
+_RimEnviroSharpness:=locale::_RimEnviroSharpness_text--{tooltip:locale::_RimEnviroSharpness_tooltip}
+_RimEnviroMinBrightness:=locale::_RimEnviroMinBrightness_text--{tooltip:locale::_RimEnviroMinBrightness_tooltip}
+_RimEnviroIntensity:=locale::_RimEnviroIntensity_text--{tooltip:locale::_RimEnviroIntensity_tooltip}
+_GIEmissionMultiplier:=locale::_GIEmissionMultiplier_text--{tooltip:locale::_GIEmissionMultiplier_tooltip}
+DSGI:=locale::DSGI_text--{tooltip:locale::DSGI_tooltip}
+LightmapFlags:=locale::LightmapFlags_text--{tooltip:locale::LightmapFlags_tooltip}
+_EnableMetallic:=locale::_EnableMetallic_text--{tooltip:locale::_EnableMetallic_tooltip}
+_CubeMap:=locale::_CubeMap_text--{tooltip:locale::_CubeMap_tooltip}
+_SampleWorld:=locale::_SampleWorld_text--{tooltip:locale::_SampleWorld_tooltip}
+_MetalReflectionTint:=locale::_MetalReflectionTint_text--{tooltip:locale::_MetalReflectionTint_tooltip}
+_MetallicMask:=locale::_MetallicMask_text--{tooltip:locale::_MetallicMask_tooltip}
+_Metallic:=locale::_Metallic_text--{tooltip:locale::_Metallic_tooltip}
+_SmoothnessMask:=locale::_SmoothnessMask_text--{tooltip:locale::_SmoothnessMask_tooltip}
+_InvertSmoothness:=locale::_InvertSmoothness_text--{tooltip:locale::_InvertSmoothness_tooltip}
+_Smoothness:=locale::_Smoothness_text--{tooltip:locale::_Smoothness_tooltip}
+_EnableClearCoat:=locale::_EnableClearCoat_text--{tooltip:locale::_EnableClearCoat_tooltip}
+_ClearCoatNormalToUse:=locale::_ClearCoatNormalToUse_text--{tooltip:locale::_ClearCoatNormalToUse_tooltip}
+_ClearCoatCubeMap:=locale::_ClearCoatCubeMap_text--{tooltip:locale::_ClearCoatCubeMap_tooltip}
+_ClearCoatSampleWorld:=locale::_ClearCoatSampleWorld_text--{tooltip:locale::_ClearCoatSampleWorld_tooltip}
+_ClearCoatTint:=locale::_ClearCoatTint_text--{tooltip:locale::_ClearCoatTint_tooltip}
+_ClearCoatMask:=locale::_ClearCoatMask_text--{tooltip:locale::_ClearCoatMask_tooltip}
+_ClearCoat:=locale::_ClearCoat_text--{tooltip:locale::_ClearCoat_tooltip}
+_ClearCoatSmoothnessMap:=locale::_ClearCoatSmoothnessMap_text--{tooltip:locale::_ClearCoatSmoothnessMap_tooltip}
+_ClearCoatInvertSmoothness:=locale::_ClearCoatInvertSmoothness_text--{tooltip:locale::_ClearCoatInvertSmoothness_tooltip}
+_ClearCoatSmoothness:=locale::_ClearCoatSmoothness_text--{tooltip:locale::_ClearCoatSmoothness_tooltip}
+_ClearCoatForceLighting:=locale::_ClearCoatForceLighting_text--{tooltip:locale::_ClearCoatForceLighting_tooltip}
+_MatcapEnable:=locale::_MatcapEnable_text--{tooltip:locale::_MatcapEnable_tooltip}
+_MatcapColor:=locale::_MatcapColor_text--{tooltip:locale::_MatcapColor_tooltip}
+_Matcap:=locale::_Matcap_text--{tooltip:locale::_Matcap_tooltip}
+_MatcapBorder:=locale::_MatcapBorder_text--{tooltip:locale::_MatcapBorder_tooltip}
+_MatcapMask:=locale::_MatcapMask_text--{tooltip:locale::_MatcapMask_tooltip}
+_MatcapEmissionStrength:=locale::_MatcapEmissionStrength_text--{tooltip:locale::_MatcapEmissionStrength_tooltip}
+_MatcapIntensity:=locale::_MatcapIntensity_text--{tooltip:locale::_MatcapIntensity_tooltip}
+_MatcapLightMask:=locale::_MatcapLightMask_text--{tooltip:locale::_MatcapLightMask_tooltip}
+_MatcapReplace:=locale::_MatcapReplace_text--{tooltip:locale::_MatcapReplace_tooltip}
+_MatcapMultiply:=locale::_MatcapMultiply_text--{tooltip:locale::_MatcapMultiply_tooltip}
+_MatcapAdd:=locale::_MatcapAdd_text--{tooltip:locale::_MatcapAdd_tooltip}
+_MatcapNormal:=locale::_MatcapNormal_text--{tooltip:locale::_MatcapNormal_tooltip}
+_Matcap2Enable:=locale::_Matcap2Enable_text--{tooltip:locale::_Matcap2Enable_tooltip}
+_Matcap2Color:=locale::_Matcap2Color_text--{tooltip:locale::_Matcap2Color_tooltip}
+_Matcap2:=locale::_Matcap2_text--{tooltip:locale::_Matcap2_tooltip}
+_Matcap2Border:=locale::_Matcap2Border_text--{tooltip:locale::_Matcap2Border_tooltip}
+_Matcap2Mask:=locale::_Matcap2Mask_text--{tooltip:locale::_Matcap2Mask_tooltip}
+_Matcap2EmissionStrength:=locale::_Matcap2EmissionStrength_text--{tooltip:locale::_Matcap2EmissionStrength_tooltip}
+_Matcap2Intensity:=locale::_Matcap2Intensity_text--{tooltip:locale::_Matcap2Intensity_tooltip}
+_Matcap2LightMask:=locale::_Matcap2LightMask_text--{tooltip:locale::_Matcap2LightMask_tooltip}
+_Matcap2Replace:=locale::_Matcap2Replace_text--{tooltip:locale::_Matcap2Replace_tooltip}
+_Matcap2Multiply:=locale::_Matcap2Multiply_text--{tooltip:locale::_Matcap2Multiply_tooltip}
+_Matcap2Add:=locale::_Matcap2Add_text--{tooltip:locale::_Matcap2Add_tooltip}
+_Matcap2Normal:=locale::_Matcap2Normal_text--{tooltip:locale::_Matcap2Normal_tooltip}
+_EnableSpecular:=locale::_EnableSpecular_text--{tooltip:locale::_EnableSpecular_tooltip}
+_SpecularType:=locale::_SpecularType_text--{tooltip:locale::_SpecularType_tooltip}
+_SpecularMinLightBrightness:=locale::_SpecularMinLightBrightness_text--{tooltip:locale::_SpecularMinLightBrightness_tooltip}
+_SpecularTint:=locale::_SpecularTint_text--{tooltip:locale::_SpecularTint_tooltip}
+_SpecularMetallic:=locale::_SpecularMetallic_text--{tooltip:locale::_SpecularMetallic_tooltip}
+_SpecularSmoothness:=locale::_SpecularSmoothness_text--{tooltip:locale::_SpecularSmoothness_tooltip}
+_SpecularMap:=locale::_SpecularMap_text--{tooltip:locale::_SpecularMap_tooltip}
+_SpecularInvertSmoothness:=locale::_SpecularInvertSmoothness_text--{tooltip:locale::_SpecularInvertSmoothness_tooltip}
+_SpecularMask:=locale::_SpecularMask_text--{tooltip:locale::_SpecularMask_tooltip}
+_SmoothnessFrom:=locale::_SmoothnessFrom_text--{tooltip:locale::_SmoothnessFrom_tooltip}
+_SpecularToonInnerOuter:=locale::_SpecularToonInnerOuter_text--{tooltip:locale::_SpecularToonInnerOuter_tooltip}
+_SpecWhatTangent:=locale::_SpecWhatTangent_text--{tooltip:locale::_SpecWhatTangent_tooltip}
+_AnisoSpec1Alpha:=locale::_AnisoSpec1Alpha_text--{tooltip:locale::_AnisoSpec1Alpha_tooltip}
+_AnisoSpec2Alpha:=locale::_AnisoSpec2Alpha_text--{tooltip:locale::_AnisoSpec2Alpha_tooltip}
+_Spec2Smoothness:=locale::_Spec2Smoothness_text--{tooltip:locale::_Spec2Smoothness_tooltip}
+_AnisoUseTangentMap:=locale::_AnisoUseTangentMap_text--{tooltip:locale::_AnisoUseTangentMap_tooltip}
+_AnisoTangentMap:=locale::_AnisoTangentMap_text--{tooltip:locale::_AnisoTangentMap_tooltip}
+_EnableSpecular1:=locale::_EnableSpecular1_text--{tooltip:locale::_EnableSpecular1_tooltip}
+_SpecularType1:=locale::_SpecularType1_text--{tooltip:locale::_SpecularType1_tooltip}
+_SpecularMinLightBrightness1:=locale::_SpecularMinLightBrightness1_text--{tooltip:locale::_SpecularMinLightBrightness1_tooltip}
+_SpecularTint1:=locale::_SpecularTint1_text--{tooltip:locale::_SpecularTint1_tooltip}
+_SpecularMetallic1:=locale::_SpecularMetallic1_text--{tooltip:locale::_SpecularMetallic1_tooltip}
+_SpecularSmoothness1:=locale::_SpecularSmoothness1_text--{tooltip:locale::_SpecularSmoothness1_tooltip}
+_SpecularMap1:=locale::_SpecularMap1_text--{tooltip:locale::_SpecularMap1_tooltip}
+_SpecularInvertSmoothness1:=locale::_SpecularInvertSmoothness1_text--{tooltip:locale::_SpecularInvertSmoothness1_tooltip}
+_SpecularMask1:=locale::_SpecularMask1_text--{tooltip:locale::_SpecularMask1_tooltip}
+_SmoothnessFrom1:=locale::_SmoothnessFrom1_text--{tooltip:locale::_SmoothnessFrom1_tooltip}
+_SpecularToonInnerOuter1:=locale::_SpecularToonInnerOuter1_text--{tooltip:locale::_SpecularToonInnerOuter1_tooltip}
+_SpecWhatTangent1:=locale::_SpecWhatTangent1_text--{tooltip:locale::_SpecWhatTangent1_tooltip}
+_AnisoSpec1Alpha1:=locale::_AnisoSpec1Alpha1_text--{tooltip:locale::_AnisoSpec1Alpha1_tooltip}
+_AnisoSpec2Alpha1:=locale::_AnisoSpec2Alpha1_text--{tooltip:locale::_AnisoSpec2Alpha1_tooltip}
+_Spec2Smoothness1:=locale::_Spec2Smoothness1_text--{tooltip:locale::_Spec2Smoothness1_tooltip}
+_AnisoUseTangentMap1:=locale::_AnisoUseTangentMap1_text--{tooltip:locale::_AnisoUseTangentMap1_tooltip}
+_AnisoTangentMap1:=locale::_AnisoTangentMap1_text--{tooltip:locale::_AnisoTangentMap1_tooltip}
+_EnableEmission:=locale::_EnableEmission_text--{tooltip:locale::_EnableEmission_tooltip}
+_EmissionMaskUV:=locale::_EmissionMaskUV_text--{tooltip:locale::_EmissionMaskUV_tooltip}
+_EmissionMapUV:=locale::_EmissionMapUV_text--{tooltip:locale::_EmissionMapUV_tooltip}
+_EmissionColor:=locale::_EmissionColor_text--{tooltip:locale::_EmissionColor_tooltip}
+_EmissionMap:=locale::_EmissionMap_text--{tooltip:locale::_EmissionMap_tooltip}
+_EmissionMask:=locale::_EmissionMask_text--{tooltip:locale::_EmissionMask_tooltip}
+_EmissionMapPan:=locale::_EmissionMapPan_text--{tooltip:locale::_EmissionMapPan_tooltip}
+_EmissionMaskPan:=locale::_EmissionMaskPan_text--{tooltip:locale::_EmissionMaskPan_tooltip}
+_EmissionStrength:=locale::_EmissionStrength_text--{tooltip:locale::_EmissionStrength_tooltip}
+_EmissionCenterOutEnabled:=locale::_EmissionCenterOutEnabled_text--{tooltip:locale::_EmissionCenterOutEnabled_tooltip}
+_EmissionCenterOutSpeed:=locale::_EmissionCenterOutSpeed_text--{tooltip:locale::_EmissionCenterOutSpeed_tooltip}
+_EnableGITDEmission:=locale::_EnableGITDEmission_text--{tooltip:locale::_EnableGITDEmission_tooltip}
+_GITDEWorldOrMesh:=locale::_GITDEWorldOrMesh_text--{tooltip:locale::_GITDEWorldOrMesh_tooltip}
+_GITDEMinEmissionMultiplier:=locale::_GITDEMinEmissionMultiplier_text--{tooltip:locale::_GITDEMinEmissionMultiplier_tooltip}
+_GITDEMaxEmissionMultiplier:=locale::_GITDEMaxEmissionMultiplier_text--{tooltip:locale::_GITDEMaxEmissionMultiplier_tooltip}
+_GITDEMinLight:=locale::_GITDEMinLight_text--{tooltip:locale::_GITDEMinLight_tooltip}
+_GITDEMaxLight:=locale::_GITDEMaxLight_text--{tooltip:locale::_GITDEMaxLight_tooltip}
+_EmissiveBlink_Min:=locale::_EmissiveBlink_Min_text--{tooltip:locale::_EmissiveBlink_Min_tooltip}
+_EmissiveBlink_Max:=locale::_EmissiveBlink_Max_text--{tooltip:locale::_EmissiveBlink_Max_tooltip}
+_EmissiveBlink_Velocity:=locale::_EmissiveBlink_Velocity_text--{tooltip:locale::_EmissiveBlink_Velocity_tooltip}
+_ScrollingEmission:=locale::_ScrollingEmission_text--{tooltip:locale::_ScrollingEmission_tooltip}
+_EmissionScrollingUseCurve:=locale::_EmissionScrollingUseCurve_text--{tooltip:locale::_EmissionScrollingUseCurve_tooltip}
+_EmissionScrollingCurve:=locale::_EmissionScrollingCurve_text--{tooltip:locale::_EmissionScrollingCurve_tooltip}
+_EmissiveScroll_Direction:=locale::_EmissiveScroll_Direction_text--{tooltip:locale::_EmissiveScroll_Direction_tooltip}
+_EmissiveScroll_Width:=locale::_EmissiveScroll_Width_text--{tooltip:locale::_EmissiveScroll_Width_tooltip}
+_EmissiveScroll_Velocity:=locale::_EmissiveScroll_Velocity_text--{tooltip:locale::_EmissiveScroll_Velocity_tooltip}
+_EmissiveScroll_Interval:=locale::_EmissiveScroll_Interval_text--{tooltip:locale::_EmissiveScroll_Interval_tooltip}
+_EnableEmission1:=locale::_EnableEmission1_text--{tooltip:locale::_EnableEmission1_tooltip}
+_EmissionMask1UV:=locale::_EmissionMask1UV_text--{tooltip:locale::_EmissionMask1UV_tooltip}
+_EmissionMap1UV:=locale::_EmissionMap1UV_text--{tooltip:locale::_EmissionMap1UV_tooltip}
+_EmissionColor1:=locale::_EmissionColor1_text--{tooltip:locale::_EmissionColor1_tooltip}
+_EmissionMap1:=locale::_EmissionMap1_text--{tooltip:locale::_EmissionMap1_tooltip}
+_EmissionMask1:=locale::_EmissionMask1_text--{tooltip:locale::_EmissionMask1_tooltip}
+_EmissionMap1Pan:=locale::_EmissionMap1Pan_text--{tooltip:locale::_EmissionMap1Pan_tooltip}
+_EmissionMask1Pan:=locale::_EmissionMask1Pan_text--{tooltip:locale::_EmissionMask1Pan_tooltip}
+_EmissionStrength1:=locale::_EmissionStrength1_text--{tooltip:locale::_EmissionStrength1_tooltip}
+_EmissionCenterOutEnabled1:=locale::_EmissionCenterOutEnabled1_text--{tooltip:locale::_EmissionCenterOutEnabled1_tooltip}
+_EmissionCenterOutSpeed1:=locale::_EmissionCenterOutSpeed1_text--{tooltip:locale::_EmissionCenterOutSpeed1_tooltip}
+_EnableGITDEmission1:=locale::_EnableGITDEmission1_text--{tooltip:locale::_EnableGITDEmission1_tooltip}
+_GITDEWorldOrMesh1:=locale::_GITDEWorldOrMesh1_text--{tooltip:locale::_GITDEWorldOrMesh1_tooltip}
+_GITDEMinEmissionMultiplier1:=locale::_GITDEMinEmissionMultiplier1_text--{tooltip:locale::_GITDEMinEmissionMultiplier1_tooltip}
+_GITDEMaxEmissionMultiplier1:=locale::_GITDEMaxEmissionMultiplier1_text--{tooltip:locale::_GITDEMaxEmissionMultiplier1_tooltip}
+_GITDEMinLight1:=locale::_GITDEMinLight1_text--{tooltip:locale::_GITDEMinLight1_tooltip}
+_GITDEMaxLight1:=locale::_GITDEMaxLight1_text--{tooltip:locale::_GITDEMaxLight1_tooltip}
+_EmissiveBlink_Min1:=locale::_EmissiveBlink_Min1_text--{tooltip:locale::_EmissiveBlink_Min1_tooltip}
+_EmissiveBlink_Max1:=locale::_EmissiveBlink_Max1_text--{tooltip:locale::_EmissiveBlink_Max1_tooltip}
+_EmissiveBlink_Velocity1:=locale::_EmissiveBlink_Velocity1_text--{tooltip:locale::_EmissiveBlink_Velocity1_tooltip}
+_ScrollingEmission1:=locale::_ScrollingEmission1_text--{tooltip:locale::_ScrollingEmission1_tooltip}
+_EmissionScrollingUseCurve1:=locale::_EmissionScrollingUseCurve1_text--{tooltip:locale::_EmissionScrollingUseCurve1_tooltip}
+_EmissionScrollingCurve1:=locale::_EmissionScrollingCurve1_text--{tooltip:locale::_EmissionScrollingCurve1_tooltip}
+_EmissiveScroll_Direction1:=locale::_EmissiveScroll_Direction1_text--{tooltip:locale::_EmissiveScroll_Direction1_tooltip}
+_EmissiveScroll_Width1:=locale::_EmissiveScroll_Width1_text--{tooltip:locale::_EmissiveScroll_Width1_tooltip}
+_EmissiveScroll_Velocity1:=locale::_EmissiveScroll_Velocity1_text--{tooltip:locale::_EmissiveScroll_Velocity1_tooltip}
+_EmissiveScroll_Interval1:=locale::_EmissiveScroll_Interval1_text--{tooltip:locale::_EmissiveScroll_Interval1_tooltip}
+_EnableFlipbook:=locale::_EnableFlipbook_text--{tooltip:locale::_EnableFlipbook_tooltip}
+_FlipbookAlphaControlsFinalAlpha:=locale::_FlipbookAlphaControlsFinalAlpha_text--{tooltip:locale::_FlipbookAlphaControlsFinalAlpha_tooltip}
+_FlipbookTexArrayUV:=locale::_FlipbookTexArrayUV_text--{tooltip:locale::_FlipbookTexArrayUV_tooltip}
+_FlipbookTexArray:=locale::_FlipbookTexArray_text--{tooltip:locale::_FlipbookTexArray_tooltip}
+_FlipbookMask:=locale::_FlipbookMask_text--{tooltip:locale::_FlipbookMask_tooltip}
+_FlipbookColor:=locale::_FlipbookColor_text--{tooltip:locale::_FlipbookColor_tooltip}
+_FlipbookTotalFrames:=locale::_FlipbookTotalFrames_text--{tooltip:locale::_FlipbookTotalFrames_tooltip}
+_FlipbookFPS:=locale::_FlipbookFPS_text--{tooltip:locale::_FlipbookFPS_tooltip}
+_FlipbookScaleOffset:=locale::_FlipbookScaleOffset_text--{tooltip:locale::_FlipbookScaleOffset_tooltip}
+_FlipbookTiled:=locale::_FlipbookTiled_text--{tooltip:locale::_FlipbookTiled_tooltip}
+_FlipbookEmissionStrength:=locale::_FlipbookEmissionStrength_text--{tooltip:locale::_FlipbookEmissionStrength_tooltip}
+_FlipbookRotation:=locale::_FlipbookRotation_text--{tooltip:locale::_FlipbookRotation_tooltip}
+_FlipbookReplace:=locale::_FlipbookReplace_text--{tooltip:locale::_FlipbookReplace_tooltip}
+_FlipbookMultiply:=locale::_FlipbookMultiply_text--{tooltip:locale::_FlipbookMultiply_tooltip}
+_FlipbookAdd:=locale::_FlipbookAdd_text--{tooltip:locale::_FlipbookAdd_tooltip}
+_FlipbookCurrentFrame:=locale::_FlipbookCurrentFrame_text--{tooltip:locale::_FlipbookCurrentFrame_tooltip}
+_EnableDissolve:=locale::_EnableDissolve_text--{tooltip:locale::_EnableDissolve_tooltip}
+_DissolveType:=locale::_DissolveType_text--{tooltip:locale::_DissolveType_tooltip}
+_DissolveEdgeWidth:=locale::_DissolveEdgeWidth_text--{tooltip:locale::_DissolveEdgeWidth_tooltip}
+_DissolveEdgeHardness:=locale::_DissolveEdgeHardness_text--{tooltip:locale::_DissolveEdgeHardness_tooltip}
+_DissolveEdgeColor:=locale::_DissolveEdgeColor_text--{tooltip:locale::_DissolveEdgeColor_tooltip}
+_DissolveEdgeGradient:=locale::_DissolveEdgeGradient_text--{tooltip:locale::_DissolveEdgeGradient_tooltip}
+_DissolveEdgeEmission:=locale::_DissolveEdgeEmission_text--{tooltip:locale::_DissolveEdgeEmission_tooltip}
+_DissolveTextureColor:=locale::_DissolveTextureColor_text--{tooltip:locale::_DissolveTextureColor_tooltip}
+_DissolveToTexture:=locale::_DissolveToTexture_text--{tooltip:locale::_DissolveToTexture_tooltip}
+_DissolveToEmissionStrength:=locale::_DissolveToEmissionStrength_text--{tooltip:locale::_DissolveToEmissionStrength_tooltip}
+_DissolveToTexturePan:=locale::_DissolveToTexturePan_text--{tooltip:locale::_DissolveToTexturePan_tooltip}
+_DissolveNoiseTexture:=locale::_DissolveNoiseTexture_text--{tooltip:locale::_DissolveNoiseTexture_tooltip}
+_DissolveInvertNoise:=locale::_DissolveInvertNoise_text--{tooltip:locale::_DissolveInvertNoise_tooltip}
+_DissolveDetailNoise:=locale::_DissolveDetailNoise_text--{tooltip:locale::_DissolveDetailNoise_tooltip}
+_DissolveInvertDetailNoise:=locale::_DissolveInvertDetailNoise_text--{tooltip:locale::_DissolveInvertDetailNoise_tooltip}
+_DissolveDetailStrength:=locale::_DissolveDetailStrength_text--{tooltip:locale::_DissolveDetailStrength_tooltip}
+_DissolveNoiseTexturePan:=locale::_DissolveNoiseTexturePan_text--{tooltip:locale::_DissolveNoiseTexturePan_tooltip}
+_DissolveDetailNoisePan:=locale::_DissolveDetailNoisePan_text--{tooltip:locale::_DissolveDetailNoisePan_tooltip}
+_DissolveAlpha:=locale::_DissolveAlpha_text--{tooltip:locale::_DissolveAlpha_tooltip}
+_DissolveMask:=locale::_DissolveMask_text--{tooltip:locale::_DissolveMask_tooltip}
+_ContinuousDissolve:=locale::_ContinuousDissolve_text--{tooltip:locale::_ContinuousDissolve_tooltip}
+_DissolveP2PWorldLocal:=locale::_DissolveP2PWorldLocal_text--{tooltip:locale::_DissolveP2PWorldLocal_tooltip}
+_DissolveP2PEdgeLength:=locale::_DissolveP2PEdgeLength_text--{tooltip:locale::_DissolveP2PEdgeLength_tooltip}
+_DissolveStartPoint:=locale::_DissolveStartPoint_text--{tooltip:locale::_DissolveStartPoint_tooltip}
+_DissolveEndPoint:=locale::_DissolveEndPoint_text--{tooltip:locale::_DissolveEndPoint_tooltip}
+_PanoToggle:=locale::_PanoToggle_text--{tooltip:locale::_PanoToggle_tooltip}
+_PanosphereColor:=locale::_PanosphereColor_text--{tooltip:locale::_PanosphereColor_tooltip}
+_PanosphereTexture:=locale::_PanosphereTexture_text--{tooltip:locale::_PanosphereTexture_tooltip}
+_PanoMask:=locale::_PanoMask_text--{tooltip:locale::_PanoMask_tooltip}
+_PanoEmission:=locale::_PanoEmission_text--{tooltip:locale::_PanoEmission_tooltip}
+_PanoBlend:=locale::_PanoBlend_text--{tooltip:locale::_PanoBlend_tooltip}
+_PanospherePan:=locale::_PanospherePan_text--{tooltip:locale::_PanospherePan_tooltip}
+_PanoCubeMapToggle:=locale::_PanoCubeMapToggle_text--{tooltip:locale::_PanoCubeMapToggle_tooltip}
+_PanoCubeMap:=locale::_PanoCubeMap_text--{tooltip:locale::_PanoCubeMap_tooltip}
+_GlitterEnable:=locale::_GlitterEnable_text--{tooltip:locale::_GlitterEnable_tooltip}
+_GlitterColor:=locale::_GlitterColor_text--{tooltip:locale::_GlitterColor_tooltip}
+_GlitterColorMap:=locale::_GlitterColorMap_text--{tooltip:locale::_GlitterColorMap_tooltip}
+_GlitterPan:=locale::_GlitterPan_text--{tooltip:locale::_GlitterPan_tooltip}
+_GlitterMask:=locale::_GlitterMask_text--{tooltip:locale::_GlitterMask_tooltip}
+_GlitterFrequency:=locale::_GlitterFrequency_text--{tooltip:locale::_GlitterFrequency_tooltip}
+_GlitterJitter:=locale::_GlitterJitter_text--{tooltip:locale::_GlitterJitter_tooltip}
+_GlitterSpeed:=locale::_GlitterSpeed_text--{tooltip:locale::_GlitterSpeed_tooltip}
+_GlitterSize:=locale::_GlitterSize_text--{tooltip:locale::_GlitterSize_tooltip}
+_GlitterContrast:=locale::_GlitterContrast_text--{tooltip:locale::_GlitterContrast_tooltip}
+_GlitterAngleRange:=locale::_GlitterAngleRange_text--{tooltip:locale::_GlitterAngleRange_tooltip}
+_GlitterMinBrightness:=locale::_GlitterMinBrightness_text--{tooltip:locale::_GlitterMinBrightness_tooltip}
+_GlitterBrightness:=locale::_GlitterBrightness_text--{tooltip:locale::_GlitterBrightness_tooltip}
+_GlitterBias:=locale::_GlitterBias_text--{tooltip:locale::_GlitterBias_tooltip}
+_TextGlyphs:=locale::_TextGlyphs_text--{tooltip:locale::_TextGlyphs_tooltip}
+_TextPixelRange:=locale::_TextPixelRange_text--{tooltip:locale::_TextPixelRange_tooltip}
+_TextEnabled:=locale::_TextEnabled_text--{tooltip:locale::_TextEnabled_tooltip}
+_TextFPSEnabled:=locale::_TextFPSEnabled_text--{tooltip:locale::_TextFPSEnabled_tooltip}
+_TextFPSColor:=locale::_TextFPSColor_text--{tooltip:locale::_TextFPSColor_tooltip}
+_TextFPSEmissionStrength:=locale::_TextFPSEmissionStrength_text--{tooltip:locale::_TextFPSEmissionStrength_tooltip}
+_TextFPSOffset:=locale::_TextFPSOffset_text--{tooltip:locale::_TextFPSOffset_tooltip}
+_TextFPSRotation:=locale::_TextFPSRotation_text--{tooltip:locale::_TextFPSRotation_tooltip}
+_TextFPSScale:=locale::_TextFPSScale_text--{tooltip:locale::_TextFPSScale_tooltip}
+_TextFPSPadding:=locale::_TextFPSPadding_text--{tooltip:locale::_TextFPSPadding_tooltip}
+_TextPositionEnabled:=locale::_TextPositionEnabled_text--{tooltip:locale::_TextPositionEnabled_tooltip}
+_TextPositionColor:=locale::_TextPositionColor_text--{tooltip:locale::_TextPositionColor_tooltip}
+_TextPositionEmissionStrength:=locale::_TextPositionEmissionStrength_text--{tooltip:locale::_TextPositionEmissionStrength_tooltip}
+_TextPositionOffset:=locale::_TextPositionOffset_text--{tooltip:locale::_TextPositionOffset_tooltip}
+_TextPositionRotation:=locale::_TextPositionRotation_text--{tooltip:locale::_TextPositionRotation_tooltip}
+_TextPositionScale:=locale::_TextPositionScale_text--{tooltip:locale::_TextPositionScale_tooltip}
+_TextPositionPadding:=locale::_TextPositionPadding_text--{tooltip:locale::_TextPositionPadding_tooltip}
+_TextTimeEnabled:=locale::_TextTimeEnabled_text--{tooltip:locale::_TextTimeEnabled_tooltip}
+_TextTimeColor:=locale::_TextTimeColor_text--{tooltip:locale::_TextTimeColor_tooltip}
+_TextTimeEmissionStrength:=locale::_TextTimeEmissionStrength_text--{tooltip:locale::_TextTimeEmissionStrength_tooltip}
+_TextTimeOffset:=locale::_TextTimeOffset_text--{tooltip:locale::_TextTimeOffset_tooltip}
+_TextTimeRotation:=locale::_TextTimeRotation_text--{tooltip:locale::_TextTimeRotation_tooltip}
+_TextTimeScale:=locale::_TextTimeScale_text--{tooltip:locale::_TextTimeScale_tooltip}
+_TextTimePadding:=locale::_TextTimePadding_text--{tooltip:locale::_TextTimePadding_tooltip}
+_EnableMirrorOptions:=locale::_EnableMirrorOptions_text--{tooltip:locale::_EnableMirrorOptions_tooltip}
+_Mirror:=locale::_Mirror_text--{tooltip:locale::_Mirror_tooltip}
+_EnableMirrorTexture:=locale::_EnableMirrorTexture_text--{tooltip:locale::_EnableMirrorTexture_tooltip}
+_MirrorTexture:=locale::_MirrorTexture_text--{tooltip:locale::_MirrorTexture_tooltip}
+_MainMinAlpha:=locale::_MainMinAlpha_text--{tooltip:locale::_MainMinAlpha_tooltip}
+_MainFadeTexture:=locale::_MainFadeTexture_text--{tooltip:locale::_MainFadeTexture_tooltip}
+_MainDistanceFade:=locale::_MainDistanceFade_text--{tooltip:locale::_MainDistanceFade_tooltip}
+_EnableRandom:=locale::_EnableRandom_text--{tooltip:locale::_EnableRandom_tooltip}
+_AngleType:=locale::_AngleType_text--{tooltip:locale::_AngleType_tooltip}
+_AngleCompareTo:=locale::_AngleCompareTo_text--{tooltip:locale::_AngleCompareTo_tooltip}
+_AngleForwardDirection:=locale::_AngleForwardDirection_text--{tooltip:locale::_AngleForwardDirection_tooltip}
+_CameraAngleMin:=locale::_CameraAngleMin_text--{tooltip:locale::_CameraAngleMin_tooltip}
+_CameraAngleMax:=locale::_CameraAngleMax_text--{tooltip:locale::_CameraAngleMax_tooltip}
+_ModelAngleMin:=locale::_ModelAngleMin_text--{tooltip:locale::_ModelAngleMin_tooltip}
+_ModelAngleMax:=locale::_ModelAngleMax_text--{tooltip:locale::_ModelAngleMax_tooltip}
+_AngleMinAlpha:=locale::_AngleMinAlpha_text--{tooltip:locale::_AngleMinAlpha_tooltip}
+_DitheringDistanceEnabled:=locale::_DitheringDistanceEnabled_text--{tooltip:locale::_DitheringDistanceEnabled_tooltip}
+_DitheringOpaqueRange:=locale::_DitheringOpaqueRange_text--{tooltip:locale::_DitheringOpaqueRange_tooltip}
+_DitheringInvisibleRange:=locale::_DitheringInvisibleRange_text--{tooltip:locale::_DitheringInvisibleRange_tooltip}
+_DitheringDistanceMinAlpha:=locale::_DitheringDistanceMinAlpha_text--{tooltip:locale::_DitheringDistanceMinAlpha_tooltip}
+_DitheringDistanceMaxAlpha:=locale::_DitheringDistanceMaxAlpha_text--{tooltip:locale::_DitheringDistanceMaxAlpha_tooltip}
+_EnableDistortion:=locale::_EnableDistortion_text--{tooltip:locale::_EnableDistortion_tooltip}
+_DistortionFlowTexture:=locale::_DistortionFlowTexture_text--{tooltip:locale::_DistortionFlowTexture_tooltip}
+_DistortionFlowTexture1:=locale::_DistortionFlowTexture1_text--{tooltip:locale::_DistortionFlowTexture1_tooltip}
+_DistortionStrength:=locale::_DistortionStrength_text--{tooltip:locale::_DistortionStrength_tooltip}
+_DistortionStrength1:=locale::_DistortionStrength1_text--{tooltip:locale::_DistortionStrength1_tooltip}
+_DistortionSpeed:=locale::_DistortionSpeed_text--{tooltip:locale::_DistortionSpeed_tooltip}
+_DistortionSpeed1:=locale::_DistortionSpeed1_text--{tooltip:locale::_DistortionSpeed1_tooltip}
+_EnableVideo:=locale::_EnableVideo_text--{tooltip:locale::_EnableVideo_tooltip}
+_VideoUVNumber:=locale::_VideoUVNumber_text--{tooltip:locale::_VideoUVNumber_tooltip}
+_VideoType:=locale::_VideoType_text--{tooltip:locale::_VideoType_tooltip}
+_VideoBacklight:=locale::_VideoBacklight_text--{tooltip:locale::_VideoBacklight_tooltip}
+_VideoPixelTexture:=locale::_VideoPixelTexture_text--{tooltip:locale::_VideoPixelTexture_tooltip}
+_VideoResolution:=locale::_VideoResolution_text--{tooltip:locale::_VideoResolution_tooltip}
+_VideoMaskTexture:=locale::_VideoMaskTexture_text--{tooltip:locale::_VideoMaskTexture_tooltip}
+_VideoMaskPanning:=locale::_VideoMaskPanning_text--{tooltip:locale::_VideoMaskPanning_tooltip}
+_VideoEnableVideoPlayer:=locale::_VideoEnableVideoPlayer_text--{tooltip:locale::_VideoEnableVideoPlayer_tooltip}
+_VideoPixelateToResolution:=locale::_VideoPixelateToResolution_text--{tooltip:locale::_VideoPixelateToResolution_tooltip}
+_VideoRepeatVideoTexture:=locale::_VideoRepeatVideoTexture_text--{tooltip:locale::_VideoRepeatVideoTexture_tooltip}
+_VideoPanning:=locale::_VideoPanning_text--{tooltip:locale::_VideoPanning_tooltip}
+_VideoTiling:=locale::_VideoTiling_text--{tooltip:locale::_VideoTiling_tooltip}
+_VideoOffset:=locale::_VideoOffset_text--{tooltip:locale::_VideoOffset_tooltip}
+_VideoSaturation:=locale::_VideoSaturation_text--{tooltip:locale::_VideoSaturation_tooltip}
+_VideoContrast:=locale::_VideoContrast_text--{tooltip:locale::_VideoContrast_tooltip}
+_VideoEnableDebug:=locale::_VideoEnableDebug_text--{tooltip:locale::_VideoEnableDebug_tooltip}
+_VideoDebugTexture:=locale::_VideoDebugTexture_text--{tooltip:locale::_VideoDebugTexture_tooltip}
+_VideoCRTRefreshRate:=locale::_VideoCRTRefreshRate_text--{tooltip:locale::_VideoCRTRefreshRate_tooltip}
+_VideoCRTPixelEnergizedTime:=locale::_VideoCRTPixelEnergizedTime_text--{tooltip:locale::_VideoCRTPixelEnergizedTime_tooltip}
+_VideoGameboyRamp:=locale::_VideoGameboyRamp_text--{tooltip:locale::_VideoGameboyRamp_tooltip}
+_EnableBulge:=locale::_EnableBulge_text--{tooltip:locale::_EnableBulge_tooltip}
+_BulgeMask:=locale::_BulgeMask_text--{tooltip:locale::_BulgeMask_tooltip}
+_BuldgeFadeLength:=locale::_BuldgeFadeLength_text--{tooltip:locale::_BuldgeFadeLength_tooltip}
+_BuldgeHeight:=locale::_BuldgeHeight_text--{tooltip:locale::_BuldgeHeight_tooltip}
+_EnableTouchGlow:=locale::_EnableTouchGlow_text--{tooltip:locale::_EnableTouchGlow_tooltip}
+_DepthGlowColor:=locale::_DepthGlowColor_text--{tooltip:locale::_DepthGlowColor_tooltip}
+_DepthGradient:=locale::_DepthGradient_text--{tooltip:locale::_DepthGradient_tooltip}
+_DepthGlowEmission:=locale::_DepthGlowEmission_text--{tooltip:locale::_DepthGlowEmission_tooltip}
+_FadeLength:=locale::_FadeLength_text--{tooltip:locale::_FadeLength_tooltip}
+_EnableHolo:=locale::_EnableHolo_text--{tooltip:locale::_EnableHolo_tooltip}
+_HoloAlphaMap:=locale::_HoloAlphaMap_text--{tooltip:locale::_HoloAlphaMap_tooltip}
+_HoloCoordinateSpace:=locale::_HoloCoordinateSpace_text--{tooltip:locale::_HoloCoordinateSpace_tooltip}
+_HoloDirection:=locale::_HoloDirection_text--{tooltip:locale::_HoloDirection_tooltip}
+_HoloLineDensity:=locale::_HoloLineDensity_text--{tooltip:locale::_HoloLineDensity_tooltip}
+_HoloScrollSpeed:=locale::_HoloScrollSpeed_text--{tooltip:locale::_HoloScrollSpeed_tooltip}
+_HoloFresnelAlpha:=locale::_HoloFresnelAlpha_text--{tooltip:locale::_HoloFresnelAlpha_tooltip}
+_HoloRimSharpness:=locale::_HoloRimSharpness_text--{tooltip:locale::_HoloRimSharpness_tooltip}
+_HoloRimWidth:=locale::_HoloRimWidth_text--{tooltip:locale::_HoloRimWidth_tooltip}
+_WireframeEnable:=locale::_WireframeEnable_text--{tooltip:locale::_WireframeEnable_tooltip}
+_WireframeQuad:=locale::_WireframeQuad_text--{tooltip:locale::_WireframeQuad_tooltip}
+_WireframeColor:=locale::_WireframeColor_text--{tooltip:locale::_WireframeColor_tooltip}
+_WireframeTexture:=locale::_WireframeTexture_text--{tooltip:locale::_WireframeTexture_tooltip}
+_WireframeUV:=locale::_WireframeUV_text--{tooltip:locale::_WireframeUV_tooltip}
+_WireframeTexturePan:=locale::_WireframeTexturePan_text--{tooltip:locale::_WireframeTexturePan_tooltip}
+_WireframeEmissionStrength:=locale::_WireframeEmissionStrength_text--{tooltip:locale::_WireframeEmissionStrength_tooltip}
+_WireframeThickness:=locale::_WireframeThickness_text--{tooltip:locale::_WireframeThickness_tooltip}
+_WireframeEdgeOpacity:=locale::_WireframeEdgeOpacity_text--{tooltip:locale::_WireframeEdgeOpacity_tooltip}
+_WireframeFaceOpacity:=locale::_WireframeFaceOpacity_text--{tooltip:locale::_WireframeFaceOpacity_tooltip}
+_ParallaxMap:=locale::_ParallaxMap_text--{tooltip:locale::_ParallaxMap_tooltip}
+_ParallaxHeightMapEnabled:=locale::_ParallaxHeightMapEnabled_text--{tooltip:locale::_ParallaxHeightMapEnabled_tooltip}
+_ParallaxInternalMapEnabled:=locale::_ParallaxInternalMapEnabled_text--{tooltip:locale::_ParallaxInternalMapEnabled_tooltip}
+_ParallaxUV:=locale::_ParallaxUV_text--{tooltip:locale::_ParallaxUV_tooltip}
+_ParallaxHeightMap:=locale::_ParallaxHeightMap_text--{tooltip:locale::_ParallaxHeightMap_tooltip}
+_ParallaxStrength:=locale::_ParallaxStrength_text--{tooltip:locale::_ParallaxStrength_tooltip}
+_ParallaxInternalHeightmapMode:=locale::_ParallaxInternalHeightmapMode_text--{tooltip:locale::_ParallaxInternalHeightmapMode_tooltip}
+_ParallaxInternalHeightFromAlpha:=locale::_ParallaxInternalHeightFromAlpha_text--{tooltip:locale::_ParallaxInternalHeightFromAlpha_tooltip}
+_ParallaxInternalMap:=locale::_ParallaxInternalMap_text--{tooltip:locale::_ParallaxInternalMap_tooltip}
+_ParallaxInternalIterations:=locale::_ParallaxInternalIterations_text--{tooltip:locale::_ParallaxInternalIterations_tooltip}
+_ParallaxInternalMinDepth:=locale::_ParallaxInternalMinDepth_text--{tooltip:locale::_ParallaxInternalMinDepth_tooltip}
+_ParallaxInternalMaxDepth:=locale::_ParallaxInternalMaxDepth_text--{tooltip:locale::_ParallaxInternalMaxDepth_tooltip}
+_ParallaxInternalMinFade:=locale::_ParallaxInternalMinFade_text--{tooltip:locale::_ParallaxInternalMinFade_tooltip}
+_ParallaxInternalMaxFade:=locale::_ParallaxInternalMaxFade_text--{tooltip:locale::_ParallaxInternalMaxFade_tooltip}
+_ParallaxInternalMinColor:=locale::_ParallaxInternalMinColor_text--{tooltip:locale::_ParallaxInternalMinColor_tooltip}
+_ParallaxInternalMaxColor:=locale::_ParallaxInternalMaxColor_text--{tooltip:locale::_ParallaxInternalMaxColor_tooltip}
+_ParallaxInternalPanSpeed:=locale::_ParallaxInternalPanSpeed_text--{tooltip:locale::_ParallaxInternalPanSpeed_tooltip}
+_ParallaxInternalPanDepthSpeed:=locale::_ParallaxInternalPanDepthSpeed_text--{tooltip:locale::_ParallaxInternalPanDepthSpeed_tooltip}
+_ParallaxBias:=locale::_ParallaxBias_text--{tooltip:locale::_ParallaxBias_tooltip}
+_Cull:=locale::_Cull_text--{tooltip:locale::_Cull_tooltip}
+_ZTest:=locale::_ZTest_text--{tooltip:locale::_ZTest_tooltip}
+_SourceBlend:=locale::_SourceBlend_text--{tooltip:locale::_SourceBlend_tooltip}
+_DestinationBlend:=locale::_DestinationBlend_text--{tooltip:locale::_DestinationBlend_tooltip}
+_ZWrite:=locale::_ZWrite_text--{tooltip:locale::_ZWrite_tooltip}
+_ZBias:=locale::_ZBias_text--{tooltip:locale::_ZBias_tooltip}
+_IgnoreFog:=locale::_IgnoreFog_text--{tooltip:locale::_IgnoreFog_tooltip}
+Instancing:=locale::Instancing_text--{tooltip:locale::Instancing_tooltip}
+_StencilRef:=locale::_StencilRef_text--{tooltip:locale::_StencilRef_tooltip}
+_StencilPassOp:=locale::_StencilPassOp_text--{tooltip:locale::_StencilPassOp_tooltip}
+_StencilFailOp:=locale::_StencilFailOp_text--{tooltip:locale::_StencilFailOp_tooltip}
+_StencilZFailOp:=locale::_StencilZFailOp_text--{tooltip:locale::_StencilZFailOp_tooltip}
+_StencilCompareFunction:=locale::_StencilCompareFunction_text--{tooltip:locale::_StencilCompareFunction_tooltip}
+_DebugEnabled:=locale::_DebugEnabled_text--{tooltip:locale::_DebugEnabled_tooltip}
+_DebugMeshData:=locale::_DebugMeshData_text--{tooltip:locale::_DebugMeshData_tooltip}
+_DebugLightingData:=locale::_DebugLightingData_text--{tooltip:locale::_DebugLightingData_tooltip}
+_DebugSpecularData:=locale::_DebugSpecularData_text--{tooltip:locale::_DebugSpecularData_tooltip}
+_DebugCameraData:=locale::_DebugCameraData_text--{tooltip:locale::_DebugCameraData_tooltip}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_label.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_label.meta
new file mode 100644
index 00000000..8be93531
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_label.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 27b62ee8dbe4e66418c48f1d9d960c5b
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_locale.csv b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_locale.csv
new file mode 100644
index 00000000..f6f665b0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_locale.csv
@@ -0,0 +1,1205 @@
+,English
+m_mainOptions_text,m_mainOptions
+m_mainOptions_tooltip,
+m_start_RGBMask_text,m_start_RGBMask
+m_start_RGBMask_tooltip,
+m_end_RGBMask_text,m_end_RGBMask
+m_end_RGBMask_tooltip,
+m_start_DetailOptions_text,m_start_DetailOptions
+m_start_DetailOptions_tooltip,
+m_end_DetailOptions_text,m_end_DetailOptions
+m_end_DetailOptions_tooltip,
+m_start_vertexManipulation_text,m_start_vertexManipulation
+m_start_vertexManipulation_tooltip,
+m_end_vertexManipulation_text,m_end_vertexManipulation
+m_end_vertexManipulation_tooltip,
+m_start_Alpha_text,m_start_Alpha
+m_start_Alpha_tooltip,
+m_end_Alpha_text,m_end_Alpha
+m_end_Alpha_tooltip,
+m_start_backFace_text,m_start_backFace
+m_start_backFace_tooltip,
+m_end_backFace_text,m_end_backFace
+m_end_backFace_tooltip,
+m_lightingOptions_text,m_lightingOptions
+m_lightingOptions_tooltip,
+m_start_Lighting_text,m_start_Lighting
+m_start_Lighting_tooltip,
+m_start_lightingStandard_text,m_start_lightingStandard
+m_start_lightingStandard_tooltip,
+m_end_lightingStandard_text,m_end_lightingStandard
+m_end_lightingStandard_tooltip,
+m_start_lightingAdvanced_text,m_start_lightingAdvanced
+m_start_lightingAdvanced_tooltip,
+m_end_lightingAdvanced_text,m_end_lightingAdvanced
+m_end_lightingAdvanced_tooltip,
+m_start_lightingBeta_text,m_start_lightingBeta
+m_start_lightingBeta_tooltip,
+m_end_lightingBeta_text,m_end_lightingBeta
+m_end_lightingBeta_tooltip,
+m_end_Lighting_text,m_end_Lighting
+m_end_Lighting_tooltip,
+m_start_subsurface_text,m_start_subsurface
+m_start_subsurface_tooltip,
+m_end_subsurface_text,m_end_subsurface
+m_end_subsurface_tooltip,
+m_start_rimLightOptions_text,m_start_rimLightOptions
+m_start_rimLightOptions_tooltip,
+m_start_rimWidthNoise_text,m_start_rimWidthNoise
+m_start_rimWidthNoise_tooltip,
+m_end_rimWidthNoise_text,m_end_rimWidthNoise
+m_end_rimWidthNoise_tooltip,
+m_start_ShadowMix_text,m_start_ShadowMix
+m_start_ShadowMix_tooltip,
+m_end_ShadowMix_text,m_end_ShadowMix
+m_end_ShadowMix_tooltip,
+m_end_rimLightOptions_text,m_end_rimLightOptions
+m_end_rimLightOptions_tooltip,
+m_start_reflectionRim_text,m_start_reflectionRim
+m_start_reflectionRim_tooltip,
+m_end_reflectionRim_text,m_end_reflectionRim
+m_end_reflectionRim_tooltip,
+m_start_bakedLighting_text,m_start_bakedLighting
+m_start_bakedLighting_tooltip,
+m_end_bakedLighting_text,m_end_bakedLighting
+m_end_bakedLighting_tooltip,
+m_reflectionOptions_text,m_reflectionOptions
+m_reflectionOptions_tooltip,
+m_start_Metallic_text,m_start_Metallic
+m_start_Metallic_tooltip,
+m_end_Metallic_text,m_end_Metallic
+m_end_Metallic_tooltip,
+m_start_clearCoat_text,m_start_clearCoat
+m_start_clearCoat_tooltip,
+m_end_clearCoat_text,m_end_clearCoat
+m_end_clearCoat_tooltip,
+m_start_matcap_text,m_start_matcap
+m_start_matcap_tooltip,
+m_end_matcap_text,m_end_matcap
+m_end_matcap_tooltip,
+m_start_Matcap2_text,m_start_Matcap2
+m_start_Matcap2_tooltip,
+m_end_Matcap2_text,m_end_Matcap2
+m_end_Matcap2_tooltip,
+m_start_specular_text,m_start_specular
+m_start_specular_tooltip,
+m_start_SpecularToon_text,m_start_SpecularToon
+m_start_SpecularToon_tooltip,
+m_end_SpecularToon_text,m_end_SpecularToon
+m_end_SpecularToon_tooltip,
+m_start_Anisotropic_text,m_start_Anisotropic
+m_start_Anisotropic_tooltip,
+m_end_Anisotropic_text,m_end_Anisotropic
+m_end_Anisotropic_tooltip,
+m_end_specular_text,m_end_specular
+m_end_specular_tooltip,
+m_start_specular1_text,m_start_specular1
+m_start_specular1_tooltip,
+m_start_SpecularToon1_text,m_start_SpecularToon1
+m_start_SpecularToon1_tooltip,
+m_end_SpecularToon1_text,m_end_SpecularToon1
+m_end_SpecularToon1_tooltip,
+m_start_Anisotropic1_text,m_start_Anisotropic1
+m_start_Anisotropic1_tooltip,
+m_end_Anisotropic1_text,m_end_Anisotropic1
+m_end_Anisotropic1_tooltip,
+m_end_specular1_text,m_end_specular1
+m_end_specular1_tooltip,
+m_Special_Effects_text,m_Special_Effects
+m_Special_Effects_tooltip,
+m_start_emissionOptions_text,m_start_emissionOptions
+m_start_emissionOptions_tooltip,
+m_start_CenterOutEmission_text,m_start_CenterOutEmission
+m_start_CenterOutEmission_tooltip,
+m_end_CenterOutEmission_text,m_end_CenterOutEmission
+m_end_CenterOutEmission_tooltip,
+m_start_glowInDarkEmissionOptions_text,m_start_glowInDarkEmissionOptions
+m_start_glowInDarkEmissionOptions_tooltip,
+m_end_glowInDarkEmissionOptions_text,m_end_glowInDarkEmissionOptions
+m_end_glowInDarkEmissionOptions_tooltip,
+m_start_blinkingEmissionOptions_text,m_start_blinkingEmissionOptions
+m_start_blinkingEmissionOptions_tooltip,
+m_end_blinkingEmissionOptions_text,m_end_blinkingEmissionOptions
+m_end_blinkingEmissionOptions_tooltip,
+m_start_scrollingEmissionOptions_text,m_start_scrollingEmissionOptions
+m_start_scrollingEmissionOptions_tooltip,
+m_end_scrollingEmissionOptions_text,m_end_scrollingEmissionOptions
+m_end_scrollingEmissionOptions_tooltip,
+m_end_emissionOptions_text,m_end_emissionOptions
+m_end_emissionOptions_tooltip,
+m_start_emission1Options_text,m_start_emission1Options
+m_start_emission1Options_tooltip,
+m_start_CenterOutEmission1_text,m_start_CenterOutEmission1
+m_start_CenterOutEmission1_tooltip,
+m_end_CenterOutEmission1_text,m_end_CenterOutEmission1
+m_end_CenterOutEmission1_tooltip,
+m_start_glowInDarkEmissionOptions1_text,m_start_glowInDarkEmissionOptions1
+m_start_glowInDarkEmissionOptions1_tooltip,
+m_end_glowInDarkEmissionOptions1_text,m_end_glowInDarkEmissionOptions1
+m_end_glowInDarkEmissionOptions1_tooltip,
+m_start_blinkingEmissionOptions1_text,m_start_blinkingEmissionOptions1
+m_start_blinkingEmissionOptions1_tooltip,
+m_end_blinkingEmissionOptions1_text,m_end_blinkingEmissionOptions1
+m_end_blinkingEmissionOptions1_tooltip,
+m_start_scrollingEmissionOptions1_text,m_start_scrollingEmissionOptions1
+m_start_scrollingEmissionOptions1_tooltip,
+m_end_scrollingEmission1Options_text,m_end_scrollingEmission1Options
+m_end_scrollingEmission1Options_tooltip,
+m_end_emission1Options_text,m_end_emission1Options
+m_end_emission1Options_tooltip,
+m_start_flipBook_text,m_start_flipBook
+m_start_flipBook_tooltip,
+m_start_manualFlipbookControl_text,m_start_manualFlipbookControl
+m_start_manualFlipbookControl_tooltip,
+m_end_manualFlipbookControl_text,m_end_manualFlipbookControl
+m_end_manualFlipbookControl_tooltip,
+m_end_flipBook_text,m_end_flipBook
+m_end_flipBook_tooltip,
+m_start_dissolve_text,m_start_dissolve
+m_start_dissolve_tooltip,
+m_start_pointToPoint_text,m_start_pointToPoint
+m_start_pointToPoint_tooltip,
+m_end_pointToPoint_text,m_end_pointToPoint
+m_end_pointToPoint_tooltip,
+m_end_dissolve_text,m_end_dissolve
+m_end_dissolve_tooltip,
+m_start_panosphereOptions_text,m_start_panosphereOptions
+m_start_panosphereOptions_tooltip,
+m_end_panosphereOptions_text,m_end_panosphereOptions
+m_end_panosphereOptions_tooltip,
+m_start_glitter_text,m_start_glitter
+m_start_glitter_tooltip,
+m_end_glitter_text,m_end_glitter
+m_end_glitter_tooltip,
+m_start_Text_text,m_start_Text
+m_start_Text_tooltip,
+m_start_TextFPS_text,m_start_TextFPS
+m_start_TextFPS_tooltip,
+m_end_TextFPS_text,m_end_TextFPS
+m_end_TextFPS_tooltip,
+m_start_TextPosition_text,m_start_TextPosition
+m_start_TextPosition_tooltip,
+m_end_TextPosition_text,m_end_TextPosition
+m_end_TextPosition_tooltip,
+m_start_TextInstanceTime_text,m_start_TextInstanceTime
+m_start_TextInstanceTime_tooltip,
+m_end_TextInstanceTime_text,m_end_TextInstanceTime
+m_end_TextInstanceTime_tooltip,
+m_end_Text_text,m_end_Text
+m_end_Text_tooltip,
+m_start_mirrorOptions_text,m_start_mirrorOptions
+m_start_mirrorOptions_tooltip,
+m_end_mirrorOptions_text,m_end_mirrorOptions
+m_end_mirrorOptions_tooltip,
+m_start_distanceFade_text,m_start_distanceFade
+m_start_distanceFade_tooltip,
+m_end_Fade_text,m_end_Fade
+m_end_Fade_tooltip,
+m_start_angularFade_text,m_start_angularFade
+m_start_angularFade_tooltip,
+m_end_angularFade_text,m_end_angularFade
+m_end_angularFade_tooltip,
+m_start_distanceDithering_text,m_start_distanceDithering
+m_start_distanceDithering_tooltip,
+m_end_distanceDithering_text,m_end_distanceDithering
+m_end_distanceDithering_tooltip,
+m_start_distortionFlow_text,m_start_distortionFlow
+m_start_distortionFlow_tooltip,
+m_end_distortionFlow_text,m_end_distortionFlow
+m_end_distortionFlow_tooltip,
+m_Patreon_text,m_Patreon
+m_Patreon_tooltip,
+m_start_Video_text,m_start_Video
+m_start_Video_tooltip,
+m_start_VideoSettings_text,m_start_VideoSettings
+m_start_VideoSettings_tooltip,
+m_end_VideoSettings_text,m_end_VideoSettings
+m_end_VideoSettings_tooltip,
+m_start_VideoDebug_text,m_start_VideoDebug
+m_start_VideoDebug_tooltip,
+m_end_VideoDebug_text,m_end_VideoDebug
+m_end_VideoDebug_tooltip,
+m_start_CRT_text,m_start_CRT
+m_start_CRT_tooltip,
+m_end_CRT_text,m_end_CRT
+m_end_CRT_tooltip,
+m_start_Gameboy_text,m_start_Gameboy
+m_start_Gameboy_tooltip,
+m_end_Gameboy_text,m_end_Gameboy
+m_end_Gameboy_tooltip,
+m_end_Video_text,m_end_Video
+m_end_Video_tooltip,
+m_start_TouchOptions_text,m_start_TouchOptions
+m_start_TouchOptions_tooltip,
+m_start_Bulge_text,m_start_Bulge
+m_start_Bulge_tooltip,
+m_end_Bulge_text,m_end_Bulge
+m_end_Bulge_tooltip,
+m_start_TouchGlow_text,m_start_TouchGlow
+m_start_TouchGlow_tooltip,
+m_end_TouchGlow_text,m_end_TouchGlow
+m_end_TouchGlow_tooltip,
+m_end_TouchOptions_text,m_end_TouchOptions
+m_end_TouchOptions_tooltip,
+m_start_Hologram_text,m_start_Hologram
+m_start_Hologram_tooltip,
+m_start_FresnelAlpha_text,m_start_FresnelAlpha
+m_start_FresnelAlpha_tooltip,
+m_end_FresnelAlpha_text,m_end_FresnelAlpha
+m_end_FresnelAlpha_tooltip,
+m_end_Hologram_text,m_end_Hologram
+m_end_Hologram_tooltip,
+m_start_wireframe_text,m_start_wireframe
+m_start_wireframe_tooltip,
+m_end_wireframe_text,m_end_wireframe
+m_end_wireframe_tooltip,
+m_ParallaxMap_text,m_ParallaxMap
+m_ParallaxMap_tooltip,
+m_start_parallaxHeightmap_text,m_start_parallaxHeightmap
+m_start_parallaxHeightmap_tooltip,
+m_end_parallaxHeightmap_text,m_end_parallaxHeightmap
+m_end_parallaxHeightmap_tooltip,
+m_start_parallaxInternal_text,m_start_parallaxInternal
+m_start_parallaxInternal_tooltip,
+m_end_parallaxInternal_text,m_end_parallaxInternal
+m_end_parallaxInternal_tooltip,
+m_start_parallaxAdvanced_text,m_start_parallaxAdvanced
+m_start_parallaxAdvanced_tooltip,
+m_end_parallaxAdvanced_text,m_end_parallaxAdvanced
+m_end_parallaxAdvanced_tooltip,
+m_renderingOptions_text,m_renderingOptions
+m_renderingOptions_tooltip,
+m_start_StencilPassOptions_text,m_start_StencilPassOptions
+m_start_StencilPassOptions_tooltip,
+m_end_StencilPassOptions_text,m_end_StencilPassOptions
+m_end_StencilPassOptions_tooltip,
+m_start_debugOptions_text,m_start_debugOptions
+m_start_debugOptions_tooltip,
+m_end_debugOptions_text,m_end_debugOptions
+m_end_debugOptions_tooltip,
+shader_is_using_thry_editor_text,shader_is_using_thry_editor
+shader_is_using_thry_editor_tooltip,
+shader_master_label_text,shader_master_label
+shader_master_label_tooltip,
+shader_presets_text,shader_presets
+shader_presets_tooltip,
+shader_properties_label_file_text,shader_properties_label_file
+shader_properties_label_file_tooltip,
+footer_youtube_text,footer_youtube
+footer_youtube_tooltip,
+footer_twitter_text,footer_twitter
+footer_twitter_tooltip,
+footer_patreon_text,footer_patreon
+footer_patreon_tooltip,
+footer_discord_text,footer_discord
+footer_discord_tooltip,
+footer_github_text,footer_github
+footer_github_tooltip,
+_Color_text,_Color
+_Color_tooltip,
+_Saturation_text,_Saturation
+_Saturation_tooltip,
+_MainVertexColoring_text,_MainVertexColoring
+_MainVertexColoring_tooltip,
+_MainEmissionStrength_text,_MainEmissionStrength
+_MainEmissionStrength_tooltip,
+_MainTex_text,_MainTex
+_MainTex_tooltip,
+_MainTextureUV_text,_MainTextureUV
+_MainTextureUV_tooltip,
+_MainHueShift_text,_MainHueShift
+_MainHueShift_tooltip,
+_BumpMap_text,_BumpMap
+_BumpMap_tooltip,
+_BumpMapUV_text,_BumpMapUV
+_BumpMapUV_tooltip,
+_BumpMapPan_text,_BumpMapPan
+_BumpMapPan_tooltip,
+_BumpScale_text,_BumpScale
+_BumpScale_tooltip,
+_AlphaMask_text,_AlphaMask
+_AlphaMask_tooltip,
+_GlobalPanSpeed_text,_GlobalPanSpeed
+_GlobalPanSpeed_tooltip,
+_RGBMaskEnabled_text,_RGBMaskEnabled
+_RGBMaskEnabled_tooltip,
+_RGBMask_text,_RGBMask
+_RGBMask_tooltip,
+_RGBMaskUV_text,_RGBMaskUV
+_RGBMaskUV_tooltip,
+_RedColor_text,_RedColor
+_RedColor_tooltip,
+_RedTexure_text,_RedTexure
+_RedTexure_tooltip,
+_RGBRed_UV_text,_RGBRed_UV
+_RGBRed_UV_tooltip,
+_GreenColor_text,_GreenColor
+_GreenColor_tooltip,
+_GreenTexture_text,_GreenTexture
+_GreenTexture_tooltip,
+_RGBGreen_UV_text,_RGBGreen_UV
+_RGBGreen_UV_tooltip,
+_BlueColor_text,_BlueColor
+_BlueColor_tooltip,
+_BlueTexture_text,_BlueTexture
+_BlueTexture_tooltip,
+_RGBBlue_UV_text,_RGBBlue_UV
+_RGBBlue_UV_tooltip,
+_DetailMask_text,_DetailMask
+_DetailMask_tooltip,
+_DetailTex_text,_DetailTex
+_DetailTex_tooltip,
+_DetailTexPan_text,_DetailTexPan
+_DetailTexPan_tooltip,
+_DetailTexUV_text,_DetailTexUV
+_DetailTexUV_tooltip,
+_DetailTexIntensity_text,_DetailTexIntensity
+_DetailTexIntensity_tooltip,
+_DetailBrightness_text,_DetailBrightness
+_DetailBrightness_tooltip,
+_DetailTint_text,_DetailTint
+_DetailTint_tooltip,
+_DetailNormalMap_text,_DetailNormalMap
+_DetailNormalMap_tooltip,
+_DetailNormalMapUV_text,_DetailNormalMapUV
+_DetailNormalMapUV_tooltip,
+_DetailNormalMapScale_text,_DetailNormalMapScale
+_DetailNormalMapScale_tooltip,
+_DetailNormalMapPan_text,_DetailNormalMapPan
+_DetailNormalMapPan_tooltip,
+_VertexManipulationLocalTranslation_text,_VertexManipulationLocalTranslation
+_VertexManipulationLocalTranslation_tooltip,
+_VertexManipulationLocalRotation_text,_VertexManipulationLocalRotation
+_VertexManipulationLocalRotation_tooltip,
+_VertexManipulationLocalScale_text,_VertexManipulationLocalScale
+_VertexManipulationLocalScale_tooltip,
+_VertexManipulationWorldTranslation_text,_VertexManipulationWorldTranslation
+_VertexManipulationWorldTranslation_tooltip,
+_VertexManipulationHeight_text,_VertexManipulationHeight
+_VertexManipulationHeight_tooltip,
+_VertexManipulationHeightUV_text,_VertexManipulationHeightUV
+_VertexManipulationHeightUV_tooltip,
+_VertexManipulationHeightMask_text,_VertexManipulationHeightMask
+_VertexManipulationHeightMask_tooltip,
+_VertexManipulationHeightBias_text,_VertexManipulationHeightBias
+_VertexManipulationHeightBias_tooltip,
+_VertexManipulationHeightPan_text,_VertexManipulationHeightPan
+_VertexManipulationHeightPan_tooltip,
+_Clip_text,_Clip
+_Clip_tooltip,
+_DitheringEnabled_text,_DitheringEnabled
+_DitheringEnabled_tooltip,
+_ForceOpaque_text,_ForceOpaque
+_ForceOpaque_tooltip,
+_MainAlphaToCoverage_text,_MainAlphaToCoverage
+_MainAlphaToCoverage_tooltip,
+_MainShadowClipMod_text,_MainShadowClipMod
+_MainShadowClipMod_tooltip,
+_MainMipScale_text,_MainMipScale
+_MainMipScale_tooltip,
+_BackFaceEnabled_text,_BackFaceEnabled
+_BackFaceEnabled_tooltip,
+_BackFaceTextureUV_text,_BackFaceTextureUV
+_BackFaceTextureUV_tooltip,
+_BackFaceTexture_text,_BackFaceTexture
+_BackFaceTexture_tooltip,
+_BackFacePanning_text,_BackFacePanning
+_BackFacePanning_tooltip,
+_BackFaceDetailIntensity_text,_BackFaceDetailIntensity
+_BackFaceDetailIntensity_tooltip,
+_BackFaceHueShift_text,_BackFaceHueShift
+_BackFaceHueShift_tooltip,
+_BackFaceEmissionStrength_text,_BackFaceEmissionStrength
+_BackFaceEmissionStrength_tooltip,
+_EnableLighting_text,_EnableLighting
+_EnableLighting_tooltip,
+_LightingType_text,_LightingType
+_LightingType_tooltip,
+_ToonRamp_text,_ToonRamp
+_ToonRamp_tooltip,
+_LightingShadowMask_text,_LightingShadowMask
+_LightingShadowMask_tooltip,
+_ShadowStrength_text,_ShadowStrength
+_ShadowStrength_tooltip,
+_ShadowOffset_text,_ShadowOffset
+_ShadowOffset_tooltip,
+_LightingAOTex_text,_LightingAOTex
+_LightingAOTex_tooltip,
+_LightingAOTexUV_text,_LightingAOTexUV
+_LightingAOTexUV_tooltip,
+_AoIndirectStrength_text,_AoIndirectStrength
+_AoIndirectStrength_tooltip,
+_AOStrength_text,_AOStrength
+_AOStrength_tooltip,
+_LightingMinLightBrightness_text,_LightingMinLightBrightness
+_LightingMinLightBrightness_tooltip,
+_LightingIndirectContribution_text,_LightingIndirectContribution
+_LightingIndirectContribution_tooltip,
+_AttenuationMultiplier_text,_AttenuationMultiplier
+_AttenuationMultiplier_tooltip,
+_LightingStandardSmoothness_text,_LightingStandardSmoothness
+_LightingStandardSmoothness_tooltip,
+_AdditiveSoftness_text,_AdditiveSoftness
+_AdditiveSoftness_tooltip,
+_AdditiveOffset_text,_AdditiveOffset
+_AdditiveOffset_tooltip,
+_LightingAdditiveIntensity_text,_LightingAdditiveIntensity
+_LightingAdditiveIntensity_tooltip,
+_LightingStandardControlsToon_text,_LightingStandardControlsToon
+_LightingStandardControlsToon_tooltip,
+_LightingNumRamps_text,_LightingNumRamps
+_LightingNumRamps_tooltip,
+_ToonRamp1_text,_ToonRamp1
+_ToonRamp1_tooltip,
+_LightingShadowStrength1_text,_LightingShadowStrength1
+_LightingShadowStrength1_tooltip,
+_ShadowOffset1_text,_ShadowOffset1
+_ShadowOffset1_tooltip,
+_ToonRamp2_text,_ToonRamp2
+_ToonRamp2_tooltip,
+_LightingShadowStrength2_text,_LightingShadowStrength2
+_LightingShadowStrength2_tooltip,
+_ShadowOffset2_text,_ShadowOffset2
+_ShadowOffset2_tooltip,
+_EnableSSS_text,_EnableSSS
+_EnableSSS_tooltip,
+_SSSColor_text,_SSSColor
+_SSSColor_tooltip,
+_SSSColorMap_text,_SSSColorMap
+_SSSColorMap_tooltip,
+_SSSThicknessMap_text,_SSSThicknessMap
+_SSSThicknessMap_tooltip,
+_SSSThicknessMod_text,_SSSThicknessMod
+_SSSThicknessMod_tooltip,
+_SSSStrength_text,_SSSStrength
+_SSSStrength_tooltip,
+_SSSPower_text,_SSSPower
+_SSSPower_tooltip,
+_SSSDistortion_text,_SSSDistortion
+_SSSDistortion_tooltip,
+_SSSNormal_text,_SSSNormal
+_SSSNormal_tooltip,
+_EnableRimLighting_text,_EnableRimLighting
+_EnableRimLighting_tooltip,
+_RimLightNormal_text,_RimLightNormal
+_RimLightNormal_tooltip,
+_RimLightingInvert_text,_RimLightingInvert
+_RimLightingInvert_tooltip,
+_RimLightColor_text,_RimLightColor
+_RimLightColor_tooltip,
+_RimWidth_text,_RimWidth
+_RimWidth_tooltip,
+_RimSharpness_text,_RimSharpness
+_RimSharpness_tooltip,
+_RimStrength_text,_RimStrength
+_RimStrength_tooltip,
+_RimBrighten_text,_RimBrighten
+_RimBrighten_tooltip,
+_RimLightColorBias_text,_RimLightColorBias
+_RimLightColorBias_tooltip,
+_RimTex_text,_RimTex
+_RimTex_tooltip,
+_RimMask_text,_RimMask
+_RimMask_tooltip,
+_RimTexPan_text,_RimTexPan
+_RimTexPan_tooltip,
+_RimWidthNoiseTexture_text,_RimWidthNoiseTexture
+_RimWidthNoiseTexture_tooltip,
+_RimWidthNoiseStrength_text,_RimWidthNoiseStrength
+_RimWidthNoiseStrength_tooltip,
+_RimWidthNoisePan_text,_RimWidthNoisePan
+_RimWidthNoisePan_tooltip,
+_ShadowMix_text,_ShadowMix
+_ShadowMix_tooltip,
+_ShadowMixThreshold_text,_ShadowMixThreshold
+_ShadowMixThreshold_tooltip,
+_ShadowMixWidthMod_text,_ShadowMixWidthMod
+_ShadowMixWidthMod_tooltip,
+_EnableEnvironmentalRim_text,_EnableEnvironmentalRim
+_EnableEnvironmentalRim_tooltip,
+_RimEnviroMask_text,_RimEnviroMask
+_RimEnviroMask_tooltip,
+_RimEnviroBlur_text,_RimEnviroBlur
+_RimEnviroBlur_tooltip,
+_RimEnviroWidth_text,_RimEnviroWidth
+_RimEnviroWidth_tooltip,
+_RimEnviroSharpness_text,_RimEnviroSharpness
+_RimEnviroSharpness_tooltip,
+_RimEnviroMinBrightness_text,_RimEnviroMinBrightness
+_RimEnviroMinBrightness_tooltip,
+_RimEnviroIntensity_text,_RimEnviroIntensity
+_RimEnviroIntensity_tooltip,
+_GIEmissionMultiplier_text,_GIEmissionMultiplier
+_GIEmissionMultiplier_tooltip,
+DSGI_text,DSGI
+DSGI_tooltip,
+LightmapFlags_text,LightmapFlags
+LightmapFlags_tooltip,
+_EnableMetallic_text,_EnableMetallic
+_EnableMetallic_tooltip,
+_CubeMap_text,_CubeMap
+_CubeMap_tooltip,
+_SampleWorld_text,_SampleWorld
+_SampleWorld_tooltip,
+_MetalReflectionTint_text,_MetalReflectionTint
+_MetalReflectionTint_tooltip,
+_MetallicMask_text,_MetallicMask
+_MetallicMask_tooltip,
+_Metallic_text,_Metallic
+_Metallic_tooltip,
+_SmoothnessMask_text,_SmoothnessMask
+_SmoothnessMask_tooltip,
+_InvertSmoothness_text,_InvertSmoothness
+_InvertSmoothness_tooltip,
+_Smoothness_text,_Smoothness
+_Smoothness_tooltip,
+_EnableClearCoat_text,_EnableClearCoat
+_EnableClearCoat_tooltip,
+_ClearCoatNormalToUse_text,_ClearCoatNormalToUse
+_ClearCoatNormalToUse_tooltip,
+_ClearCoatCubeMap_text,_ClearCoatCubeMap
+_ClearCoatCubeMap_tooltip,
+_ClearCoatSampleWorld_text,_ClearCoatSampleWorld
+_ClearCoatSampleWorld_tooltip,
+_ClearCoatTint_text,_ClearCoatTint
+_ClearCoatTint_tooltip,
+_ClearCoatMask_text,_ClearCoatMask
+_ClearCoatMask_tooltip,
+_ClearCoat_text,_ClearCoat
+_ClearCoat_tooltip,
+_ClearCoatSmoothnessMap_text,_ClearCoatSmoothnessMap
+_ClearCoatSmoothnessMap_tooltip,
+_ClearCoatInvertSmoothness_text,_ClearCoatInvertSmoothness
+_ClearCoatInvertSmoothness_tooltip,
+_ClearCoatSmoothness_text,_ClearCoatSmoothness
+_ClearCoatSmoothness_tooltip,
+_ClearCoatForceLighting_text,_ClearCoatForceLighting
+_ClearCoatForceLighting_tooltip,
+_MatcapEnable_text,_MatcapEnable
+_MatcapEnable_tooltip,
+_MatcapColor_text,_MatcapColor
+_MatcapColor_tooltip,
+_Matcap_text,_Matcap
+_Matcap_tooltip,
+_MatcapBorder_text,_MatcapBorder
+_MatcapBorder_tooltip,
+_MatcapMask_text,_MatcapMask
+_MatcapMask_tooltip,
+_MatcapEmissionStrength_text,_MatcapEmissionStrength
+_MatcapEmissionStrength_tooltip,
+_MatcapIntensity_text,_MatcapIntensity
+_MatcapIntensity_tooltip,
+_MatcapLightMask_text,_MatcapLightMask
+_MatcapLightMask_tooltip,
+_MatcapReplace_text,_MatcapReplace
+_MatcapReplace_tooltip,
+_MatcapMultiply_text,_MatcapMultiply
+_MatcapMultiply_tooltip,
+_MatcapAdd_text,_MatcapAdd
+_MatcapAdd_tooltip,
+_MatcapNormal_text,_MatcapNormal
+_MatcapNormal_tooltip,
+_Matcap2Enable_text,_Matcap2Enable
+_Matcap2Enable_tooltip,
+_Matcap2Color_text,_Matcap2Color
+_Matcap2Color_tooltip,
+_Matcap2_text,_Matcap2
+_Matcap2_tooltip,
+_Matcap2Border_text,_Matcap2Border
+_Matcap2Border_tooltip,
+_Matcap2Mask_text,_Matcap2Mask
+_Matcap2Mask_tooltip,
+_Matcap2EmissionStrength_text,_Matcap2EmissionStrength
+_Matcap2EmissionStrength_tooltip,
+_Matcap2Intensity_text,_Matcap2Intensity
+_Matcap2Intensity_tooltip,
+_Matcap2LightMask_text,_Matcap2LightMask
+_Matcap2LightMask_tooltip,
+_Matcap2Replace_text,_Matcap2Replace
+_Matcap2Replace_tooltip,
+_Matcap2Multiply_text,_Matcap2Multiply
+_Matcap2Multiply_tooltip,
+_Matcap2Add_text,_Matcap2Add
+_Matcap2Add_tooltip,
+_Matcap2Normal_text,_Matcap2Normal
+_Matcap2Normal_tooltip,
+_EnableSpecular_text,_EnableSpecular
+_EnableSpecular_tooltip,
+_SpecularType_text,_SpecularType
+_SpecularType_tooltip,
+_SpecularMinLightBrightness_text,_SpecularMinLightBrightness
+_SpecularMinLightBrightness_tooltip,
+_SpecularTint_text,_SpecularTint
+_SpecularTint_tooltip,
+_SpecularMetallic_text,_SpecularMetallic
+_SpecularMetallic_tooltip,
+_SpecularSmoothness_text,_SpecularSmoothness
+_SpecularSmoothness_tooltip,
+_SpecularMap_text,_SpecularMap
+_SpecularMap_tooltip,
+_SpecularInvertSmoothness_text,_SpecularInvertSmoothness
+_SpecularInvertSmoothness_tooltip,
+_SpecularMask_text,_SpecularMask
+_SpecularMask_tooltip,
+_SmoothnessFrom_text,_SmoothnessFrom
+_SmoothnessFrom_tooltip,
+_SpecularToonInnerOuter_text,_SpecularToonInnerOuter
+_SpecularToonInnerOuter_tooltip,
+_SpecWhatTangent_text,_SpecWhatTangent
+_SpecWhatTangent_tooltip,
+_AnisoSpec1Alpha_text,_AnisoSpec1Alpha
+_AnisoSpec1Alpha_tooltip,
+_AnisoSpec2Alpha_text,_AnisoSpec2Alpha
+_AnisoSpec2Alpha_tooltip,
+_Spec2Smoothness_text,_Spec2Smoothness
+_Spec2Smoothness_tooltip,
+_AnisoUseTangentMap_text,_AnisoUseTangentMap
+_AnisoUseTangentMap_tooltip,
+_AnisoTangentMap_text,_AnisoTangentMap
+_AnisoTangentMap_tooltip,
+_EnableSpecular1_text,_EnableSpecular1
+_EnableSpecular1_tooltip,
+_SpecularType1_text,_SpecularType1
+_SpecularType1_tooltip,
+_SpecularMinLightBrightness1_text,_SpecularMinLightBrightness1
+_SpecularMinLightBrightness1_tooltip,
+_SpecularTint1_text,_SpecularTint1
+_SpecularTint1_tooltip,
+_SpecularMetallic1_text,_SpecularMetallic1
+_SpecularMetallic1_tooltip,
+_SpecularSmoothness1_text,_SpecularSmoothness1
+_SpecularSmoothness1_tooltip,
+_SpecularMap1_text,_SpecularMap1
+_SpecularMap1_tooltip,
+_SpecularInvertSmoothness1_text,_SpecularInvertSmoothness1
+_SpecularInvertSmoothness1_tooltip,
+_SpecularMask1_text,_SpecularMask1
+_SpecularMask1_tooltip,
+_SmoothnessFrom1_text,_SmoothnessFrom1
+_SmoothnessFrom1_tooltip,
+_SpecularToonInnerOuter1_text,_SpecularToonInnerOuter1
+_SpecularToonInnerOuter1_tooltip,
+_SpecWhatTangent1_text,_SpecWhatTangent1
+_SpecWhatTangent1_tooltip,
+_AnisoSpec1Alpha1_text,_AnisoSpec1Alpha1
+_AnisoSpec1Alpha1_tooltip,
+_AnisoSpec2Alpha1_text,_AnisoSpec2Alpha1
+_AnisoSpec2Alpha1_tooltip,
+_Spec2Smoothness1_text,_Spec2Smoothness1
+_Spec2Smoothness1_tooltip,
+_AnisoUseTangentMap1_text,_AnisoUseTangentMap1
+_AnisoUseTangentMap1_tooltip,
+_AnisoTangentMap1_text,_AnisoTangentMap1
+_AnisoTangentMap1_tooltip,
+_EnableEmission_text,_EnableEmission
+_EnableEmission_tooltip,
+_EmissionMaskUV_text,_EmissionMaskUV
+_EmissionMaskUV_tooltip,
+_EmissionMapUV_text,_EmissionMapUV
+_EmissionMapUV_tooltip,
+_EmissionColor_text,_EmissionColor
+_EmissionColor_tooltip,
+_EmissionMap_text,_EmissionMap
+_EmissionMap_tooltip,
+_EmissionMask_text,_EmissionMask
+_EmissionMask_tooltip,
+_EmissionMapPan_text,_EmissionMapPan
+_EmissionMapPan_tooltip,
+_EmissionMaskPan_text,_EmissionMaskPan
+_EmissionMaskPan_tooltip,
+_EmissionStrength_text,_EmissionStrength
+_EmissionStrength_tooltip,
+_EmissionCenterOutEnabled_text,_EmissionCenterOutEnabled
+_EmissionCenterOutEnabled_tooltip,
+_EmissionCenterOutSpeed_text,_EmissionCenterOutSpeed
+_EmissionCenterOutSpeed_tooltip,
+_EnableGITDEmission_text,_EnableGITDEmission
+_EnableGITDEmission_tooltip,
+_GITDEWorldOrMesh_text,_GITDEWorldOrMesh
+_GITDEWorldOrMesh_tooltip,
+_GITDEMinEmissionMultiplier_text,_GITDEMinEmissionMultiplier
+_GITDEMinEmissionMultiplier_tooltip,
+_GITDEMaxEmissionMultiplier_text,_GITDEMaxEmissionMultiplier
+_GITDEMaxEmissionMultiplier_tooltip,
+_GITDEMinLight_text,_GITDEMinLight
+_GITDEMinLight_tooltip,
+_GITDEMaxLight_text,_GITDEMaxLight
+_GITDEMaxLight_tooltip,
+_EmissiveBlink_Min_text,_EmissiveBlink_Min
+_EmissiveBlink_Min_tooltip,
+_EmissiveBlink_Max_text,_EmissiveBlink_Max
+_EmissiveBlink_Max_tooltip,
+_EmissiveBlink_Velocity_text,_EmissiveBlink_Velocity
+_EmissiveBlink_Velocity_tooltip,
+_ScrollingEmission_text,_ScrollingEmission
+_ScrollingEmission_tooltip,
+_EmissionScrollingUseCurve_text,_EmissionScrollingUseCurve
+_EmissionScrollingUseCurve_tooltip,
+_EmissionScrollingCurve_text,_EmissionScrollingCurve
+_EmissionScrollingCurve_tooltip,
+_EmissiveScroll_Direction_text,_EmissiveScroll_Direction
+_EmissiveScroll_Direction_tooltip,
+_EmissiveScroll_Width_text,_EmissiveScroll_Width
+_EmissiveScroll_Width_tooltip,
+_EmissiveScroll_Velocity_text,_EmissiveScroll_Velocity
+_EmissiveScroll_Velocity_tooltip,
+_EmissiveScroll_Interval_text,_EmissiveScroll_Interval
+_EmissiveScroll_Interval_tooltip,
+_EnableEmission1_text,_EnableEmission1
+_EnableEmission1_tooltip,
+_EmissionMask1UV_text,_EmissionMask1UV
+_EmissionMask1UV_tooltip,
+_EmissionMap1UV_text,_EmissionMap1UV
+_EmissionMap1UV_tooltip,
+_EmissionColor1_text,_EmissionColor1
+_EmissionColor1_tooltip,
+_EmissionMap1_text,_EmissionMap1
+_EmissionMap1_tooltip,
+_EmissionMask1_text,_EmissionMask1
+_EmissionMask1_tooltip,
+_EmissionMap1Pan_text,_EmissionMap1Pan
+_EmissionMap1Pan_tooltip,
+_EmissionMask1Pan_text,_EmissionMask1Pan
+_EmissionMask1Pan_tooltip,
+_EmissionStrength1_text,_EmissionStrength1
+_EmissionStrength1_tooltip,
+_EmissionCenterOutEnabled1_text,_EmissionCenterOutEnabled1
+_EmissionCenterOutEnabled1_tooltip,
+_EmissionCenterOutSpeed1_text,_EmissionCenterOutSpeed1
+_EmissionCenterOutSpeed1_tooltip,
+_EnableGITDEmission1_text,_EnableGITDEmission1
+_EnableGITDEmission1_tooltip,
+_GITDEWorldOrMesh1_text,_GITDEWorldOrMesh1
+_GITDEWorldOrMesh1_tooltip,
+_GITDEMinEmissionMultiplier1_text,_GITDEMinEmissionMultiplier1
+_GITDEMinEmissionMultiplier1_tooltip,
+_GITDEMaxEmissionMultiplier1_text,_GITDEMaxEmissionMultiplier1
+_GITDEMaxEmissionMultiplier1_tooltip,
+_GITDEMinLight1_text,_GITDEMinLight1
+_GITDEMinLight1_tooltip,
+_GITDEMaxLight1_text,_GITDEMaxLight1
+_GITDEMaxLight1_tooltip,
+_EmissiveBlink_Min1_text,_EmissiveBlink_Min1
+_EmissiveBlink_Min1_tooltip,
+_EmissiveBlink_Max1_text,_EmissiveBlink_Max1
+_EmissiveBlink_Max1_tooltip,
+_EmissiveBlink_Velocity1_text,_EmissiveBlink_Velocity1
+_EmissiveBlink_Velocity1_tooltip,
+_ScrollingEmission1_text,_ScrollingEmission1
+_ScrollingEmission1_tooltip,
+_EmissionScrollingUseCurve1_text,_EmissionScrollingUseCurve1
+_EmissionScrollingUseCurve1_tooltip,
+_EmissionScrollingCurve1_text,_EmissionScrollingCurve1
+_EmissionScrollingCurve1_tooltip,
+_EmissiveScroll_Direction1_text,_EmissiveScroll_Direction1
+_EmissiveScroll_Direction1_tooltip,
+_EmissiveScroll_Width1_text,_EmissiveScroll_Width1
+_EmissiveScroll_Width1_tooltip,
+_EmissiveScroll_Velocity1_text,_EmissiveScroll_Velocity1
+_EmissiveScroll_Velocity1_tooltip,
+_EmissiveScroll_Interval1_text,_EmissiveScroll_Interval1
+_EmissiveScroll_Interval1_tooltip,
+_EnableFlipbook_text,_EnableFlipbook
+_EnableFlipbook_tooltip,
+_FlipbookAlphaControlsFinalAlpha_text,_FlipbookAlphaControlsFinalAlpha
+_FlipbookAlphaControlsFinalAlpha_tooltip,
+_FlipbookTexArrayUV_text,_FlipbookTexArrayUV
+_FlipbookTexArrayUV_tooltip,
+_FlipbookTexArray_text,_FlipbookTexArray
+_FlipbookTexArray_tooltip,
+_FlipbookMask_text,_FlipbookMask
+_FlipbookMask_tooltip,
+_FlipbookColor_text,_FlipbookColor
+_FlipbookColor_tooltip,
+_FlipbookTotalFrames_text,_FlipbookTotalFrames
+_FlipbookTotalFrames_tooltip,
+_FlipbookFPS_text,_FlipbookFPS
+_FlipbookFPS_tooltip,
+_FlipbookScaleOffset_text,_FlipbookScaleOffset
+_FlipbookScaleOffset_tooltip,
+_FlipbookTiled_text,_FlipbookTiled
+_FlipbookTiled_tooltip,
+_FlipbookEmissionStrength_text,_FlipbookEmissionStrength
+_FlipbookEmissionStrength_tooltip,
+_FlipbookRotation_text,_FlipbookRotation
+_FlipbookRotation_tooltip,
+_FlipbookReplace_text,_FlipbookReplace
+_FlipbookReplace_tooltip,
+_FlipbookMultiply_text,_FlipbookMultiply
+_FlipbookMultiply_tooltip,
+_FlipbookAdd_text,_FlipbookAdd
+_FlipbookAdd_tooltip,
+_FlipbookCurrentFrame_text,_FlipbookCurrentFrame
+_FlipbookCurrentFrame_tooltip,
+_EnableDissolve_text,_EnableDissolve
+_EnableDissolve_tooltip,
+_DissolveType_text,_DissolveType
+_DissolveType_tooltip,
+_DissolveEdgeWidth_text,_DissolveEdgeWidth
+_DissolveEdgeWidth_tooltip,
+_DissolveEdgeHardness_text,_DissolveEdgeHardness
+_DissolveEdgeHardness_tooltip,
+_DissolveEdgeColor_text,_DissolveEdgeColor
+_DissolveEdgeColor_tooltip,
+_DissolveEdgeGradient_text,_DissolveEdgeGradient
+_DissolveEdgeGradient_tooltip,
+_DissolveEdgeEmission_text,_DissolveEdgeEmission
+_DissolveEdgeEmission_tooltip,
+_DissolveTextureColor_text,_DissolveTextureColor
+_DissolveTextureColor_tooltip,
+_DissolveToTexture_text,_DissolveToTexture
+_DissolveToTexture_tooltip,
+_DissolveToEmissionStrength_text,_DissolveToEmissionStrength
+_DissolveToEmissionStrength_tooltip,
+_DissolveToTexturePan_text,_DissolveToTexturePan
+_DissolveToTexturePan_tooltip,
+_DissolveNoiseTexture_text,_DissolveNoiseTexture
+_DissolveNoiseTexture_tooltip,
+_DissolveInvertNoise_text,_DissolveInvertNoise
+_DissolveInvertNoise_tooltip,
+_DissolveDetailNoise_text,_DissolveDetailNoise
+_DissolveDetailNoise_tooltip,
+_DissolveInvertDetailNoise_text,_DissolveInvertDetailNoise
+_DissolveInvertDetailNoise_tooltip,
+_DissolveDetailStrength_text,_DissolveDetailStrength
+_DissolveDetailStrength_tooltip,
+_DissolveNoiseTexturePan_text,_DissolveNoiseTexturePan
+_DissolveNoiseTexturePan_tooltip,
+_DissolveDetailNoisePan_text,_DissolveDetailNoisePan
+_DissolveDetailNoisePan_tooltip,
+_DissolveAlpha_text,_DissolveAlpha
+_DissolveAlpha_tooltip,
+_DissolveMask_text,_DissolveMask
+_DissolveMask_tooltip,
+_ContinuousDissolve_text,_ContinuousDissolve
+_ContinuousDissolve_tooltip,
+_DissolveP2PWorldLocal_text,_DissolveP2PWorldLocal
+_DissolveP2PWorldLocal_tooltip,
+_DissolveP2PEdgeLength_text,_DissolveP2PEdgeLength
+_DissolveP2PEdgeLength_tooltip,
+_DissolveStartPoint_text,_DissolveStartPoint
+_DissolveStartPoint_tooltip,
+_DissolveEndPoint_text,_DissolveEndPoint
+_DissolveEndPoint_tooltip,
+_PanoToggle_text,_PanoToggle
+_PanoToggle_tooltip,
+_PanosphereColor_text,_PanosphereColor
+_PanosphereColor_tooltip,
+_PanosphereTexture_text,_PanosphereTexture
+_PanosphereTexture_tooltip,
+_PanoMask_text,_PanoMask
+_PanoMask_tooltip,
+_PanoEmission_text,_PanoEmission
+_PanoEmission_tooltip,
+_PanoBlend_text,_PanoBlend
+_PanoBlend_tooltip,
+_PanospherePan_text,_PanospherePan
+_PanospherePan_tooltip,
+_PanoCubeMapToggle_text,_PanoCubeMapToggle
+_PanoCubeMapToggle_tooltip,
+_PanoCubeMap_text,_PanoCubeMap
+_PanoCubeMap_tooltip,
+_GlitterEnable_text,_GlitterEnable
+_GlitterEnable_tooltip,
+_GlitterColor_text,_GlitterColor
+_GlitterColor_tooltip,
+_GlitterColorMap_text,_GlitterColorMap
+_GlitterColorMap_tooltip,
+_GlitterPan_text,_GlitterPan
+_GlitterPan_tooltip,
+_GlitterMask_text,_GlitterMask
+_GlitterMask_tooltip,
+_GlitterFrequency_text,_GlitterFrequency
+_GlitterFrequency_tooltip,
+_GlitterJitter_text,_GlitterJitter
+_GlitterJitter_tooltip,
+_GlitterSpeed_text,_GlitterSpeed
+_GlitterSpeed_tooltip,
+_GlitterSize_text,_GlitterSize
+_GlitterSize_tooltip,
+_GlitterContrast_text,_GlitterContrast
+_GlitterContrast_tooltip,
+_GlitterAngleRange_text,_GlitterAngleRange
+_GlitterAngleRange_tooltip,
+_GlitterMinBrightness_text,_GlitterMinBrightness
+_GlitterMinBrightness_tooltip,
+_GlitterBrightness_text,_GlitterBrightness
+_GlitterBrightness_tooltip,
+_GlitterBias_text,_GlitterBias
+_GlitterBias_tooltip,
+_TextGlyphs_text,_TextGlyphs
+_TextGlyphs_tooltip,
+_TextPixelRange_text,_TextPixelRange
+_TextPixelRange_tooltip,
+_TextEnabled_text,_TextEnabled
+_TextEnabled_tooltip,
+_TextFPSEnabled_text,_TextFPSEnabled
+_TextFPSEnabled_tooltip,
+_TextFPSColor_text,_TextFPSColor
+_TextFPSColor_tooltip,
+_TextFPSEmissionStrength_text,_TextFPSEmissionStrength
+_TextFPSEmissionStrength_tooltip,
+_TextFPSOffset_text,_TextFPSOffset
+_TextFPSOffset_tooltip,
+_TextFPSRotation_text,_TextFPSRotation
+_TextFPSRotation_tooltip,
+_TextFPSScale_text,_TextFPSScale
+_TextFPSScale_tooltip,
+_TextFPSPadding_text,_TextFPSPadding
+_TextFPSPadding_tooltip,
+_TextPositionEnabled_text,_TextPositionEnabled
+_TextPositionEnabled_tooltip,
+_TextPositionColor_text,_TextPositionColor
+_TextPositionColor_tooltip,
+_TextPositionEmissionStrength_text,_TextPositionEmissionStrength
+_TextPositionEmissionStrength_tooltip,
+_TextPositionOffset_text,_TextPositionOffset
+_TextPositionOffset_tooltip,
+_TextPositionRotation_text,_TextPositionRotation
+_TextPositionRotation_tooltip,
+_TextPositionScale_text,_TextPositionScale
+_TextPositionScale_tooltip,
+_TextPositionPadding_text,_TextPositionPadding
+_TextPositionPadding_tooltip,
+_TextTimeEnabled_text,_TextTimeEnabled
+_TextTimeEnabled_tooltip,
+_TextTimeColor_text,_TextTimeColor
+_TextTimeColor_tooltip,
+_TextTimeEmissionStrength_text,_TextTimeEmissionStrength
+_TextTimeEmissionStrength_tooltip,
+_TextTimeOffset_text,_TextTimeOffset
+_TextTimeOffset_tooltip,
+_TextTimeRotation_text,_TextTimeRotation
+_TextTimeRotation_tooltip,
+_TextTimeScale_text,_TextTimeScale
+_TextTimeScale_tooltip,
+_TextTimePadding_text,_TextTimePadding
+_TextTimePadding_tooltip,
+_EnableMirrorOptions_text,_EnableMirrorOptions
+_EnableMirrorOptions_tooltip,
+_Mirror_text,_Mirror
+_Mirror_tooltip,
+_EnableMirrorTexture_text,_EnableMirrorTexture
+_EnableMirrorTexture_tooltip,
+_MirrorTexture_text,_MirrorTexture
+_MirrorTexture_tooltip,
+_MainMinAlpha_text,_MainMinAlpha
+_MainMinAlpha_tooltip,
+_MainFadeTexture_text,_MainFadeTexture
+_MainFadeTexture_tooltip,
+_MainDistanceFade_text,_MainDistanceFade
+_MainDistanceFade_tooltip,
+_EnableRandom_text,_EnableRandom
+_EnableRandom_tooltip,
+_AngleType_text,_AngleType
+_AngleType_tooltip,
+_AngleCompareTo_text,_AngleCompareTo
+_AngleCompareTo_tooltip,
+_AngleForwardDirection_text,_AngleForwardDirection
+_AngleForwardDirection_tooltip,
+_CameraAngleMin_text,_CameraAngleMin
+_CameraAngleMin_tooltip,
+_CameraAngleMax_text,_CameraAngleMax
+_CameraAngleMax_tooltip,
+_ModelAngleMin_text,_ModelAngleMin
+_ModelAngleMin_tooltip,
+_ModelAngleMax_text,_ModelAngleMax
+_ModelAngleMax_tooltip,
+_AngleMinAlpha_text,_AngleMinAlpha
+_AngleMinAlpha_tooltip,
+_DitheringDistanceEnabled_text,_DitheringDistanceEnabled
+_DitheringDistanceEnabled_tooltip,
+_DitheringOpaqueRange_text,_DitheringOpaqueRange
+_DitheringOpaqueRange_tooltip,
+_DitheringInvisibleRange_text,_DitheringInvisibleRange
+_DitheringInvisibleRange_tooltip,
+_DitheringDistanceMinAlpha_text,_DitheringDistanceMinAlpha
+_DitheringDistanceMinAlpha_tooltip,
+_DitheringDistanceMaxAlpha_text,_DitheringDistanceMaxAlpha
+_DitheringDistanceMaxAlpha_tooltip,
+_EnableDistortion_text,_EnableDistortion
+_EnableDistortion_tooltip,
+_DistortionFlowTexture_text,_DistortionFlowTexture
+_DistortionFlowTexture_tooltip,
+_DistortionFlowTexture1_text,_DistortionFlowTexture1
+_DistortionFlowTexture1_tooltip,
+_DistortionStrength_text,_DistortionStrength
+_DistortionStrength_tooltip,
+_DistortionStrength1_text,_DistortionStrength1
+_DistortionStrength1_tooltip,
+_DistortionSpeed_text,_DistortionSpeed
+_DistortionSpeed_tooltip,
+_DistortionSpeed1_text,_DistortionSpeed1
+_DistortionSpeed1_tooltip,
+_EnableVideo_text,_EnableVideo
+_EnableVideo_tooltip,
+_VideoUVNumber_text,_VideoUVNumber
+_VideoUVNumber_tooltip,
+_VideoType_text,_VideoType
+_VideoType_tooltip,
+_VideoBacklight_text,_VideoBacklight
+_VideoBacklight_tooltip,
+_VideoPixelTexture_text,_VideoPixelTexture
+_VideoPixelTexture_tooltip,
+_VideoResolution_text,_VideoResolution
+_VideoResolution_tooltip,
+_VideoMaskTexture_text,_VideoMaskTexture
+_VideoMaskTexture_tooltip,
+_VideoMaskPanning_text,_VideoMaskPanning
+_VideoMaskPanning_tooltip,
+_VideoEnableVideoPlayer_text,_VideoEnableVideoPlayer
+_VideoEnableVideoPlayer_tooltip,
+_VideoPixelateToResolution_text,_VideoPixelateToResolution
+_VideoPixelateToResolution_tooltip,
+_VideoRepeatVideoTexture_text,_VideoRepeatVideoTexture
+_VideoRepeatVideoTexture_tooltip,
+_VideoPanning_text,_VideoPanning
+_VideoPanning_tooltip,
+_VideoTiling_text,_VideoTiling
+_VideoTiling_tooltip,
+_VideoOffset_text,_VideoOffset
+_VideoOffset_tooltip,
+_VideoSaturation_text,_VideoSaturation
+_VideoSaturation_tooltip,
+_VideoContrast_text,_VideoContrast
+_VideoContrast_tooltip,
+_VideoEnableDebug_text,_VideoEnableDebug
+_VideoEnableDebug_tooltip,
+_VideoDebugTexture_text,_VideoDebugTexture
+_VideoDebugTexture_tooltip,
+_VideoCRTRefreshRate_text,_VideoCRTRefreshRate
+_VideoCRTRefreshRate_tooltip,
+_VideoCRTPixelEnergizedTime_text,_VideoCRTPixelEnergizedTime
+_VideoCRTPixelEnergizedTime_tooltip,
+_VideoGameboyRamp_text,_VideoGameboyRamp
+_VideoGameboyRamp_tooltip,
+_EnableBulge_text,_EnableBulge
+_EnableBulge_tooltip,
+_BulgeMask_text,_BulgeMask
+_BulgeMask_tooltip,
+_BuldgeFadeLength_text,_BuldgeFadeLength
+_BuldgeFadeLength_tooltip,
+_BuldgeHeight_text,_BuldgeHeight
+_BuldgeHeight_tooltip,
+_EnableTouchGlow_text,_EnableTouchGlow
+_EnableTouchGlow_tooltip,
+_DepthGlowColor_text,_DepthGlowColor
+_DepthGlowColor_tooltip,
+_DepthGradient_text,_DepthGradient
+_DepthGradient_tooltip,
+_DepthGlowEmission_text,_DepthGlowEmission
+_DepthGlowEmission_tooltip,
+_FadeLength_text,_FadeLength
+_FadeLength_tooltip,
+_EnableHolo_text,_EnableHolo
+_EnableHolo_tooltip,
+_HoloAlphaMap_text,_HoloAlphaMap
+_HoloAlphaMap_tooltip,
+_HoloCoordinateSpace_text,_HoloCoordinateSpace
+_HoloCoordinateSpace_tooltip,
+_HoloDirection_text,_HoloDirection
+_HoloDirection_tooltip,
+_HoloLineDensity_text,_HoloLineDensity
+_HoloLineDensity_tooltip,
+_HoloScrollSpeed_text,_HoloScrollSpeed
+_HoloScrollSpeed_tooltip,
+_HoloFresnelAlpha_text,_HoloFresnelAlpha
+_HoloFresnelAlpha_tooltip,
+_HoloRimSharpness_text,_HoloRimSharpness
+_HoloRimSharpness_tooltip,
+_HoloRimWidth_text,_HoloRimWidth
+_HoloRimWidth_tooltip,
+_WireframeEnable_text,_WireframeEnable
+_WireframeEnable_tooltip,
+_WireframeQuad_text,_WireframeQuad
+_WireframeQuad_tooltip,
+_WireframeColor_text,_WireframeColor
+_WireframeColor_tooltip,
+_WireframeTexture_text,_WireframeTexture
+_WireframeTexture_tooltip,
+_WireframeUV_text,_WireframeUV
+_WireframeUV_tooltip,
+_WireframeTexturePan_text,_WireframeTexturePan
+_WireframeTexturePan_tooltip,
+_WireframeEmissionStrength_text,_WireframeEmissionStrength
+_WireframeEmissionStrength_tooltip,
+_WireframeThickness_text,_WireframeThickness
+_WireframeThickness_tooltip,
+_WireframeEdgeOpacity_text,_WireframeEdgeOpacity
+_WireframeEdgeOpacity_tooltip,
+_WireframeFaceOpacity_text,_WireframeFaceOpacity
+_WireframeFaceOpacity_tooltip,
+_ParallaxMap_text,_ParallaxMap
+_ParallaxMap_tooltip,
+_ParallaxHeightMapEnabled_text,_ParallaxHeightMapEnabled
+_ParallaxHeightMapEnabled_tooltip,
+_ParallaxInternalMapEnabled_text,_ParallaxInternalMapEnabled
+_ParallaxInternalMapEnabled_tooltip,
+_ParallaxUV_text,_ParallaxUV
+_ParallaxUV_tooltip,
+_ParallaxHeightMap_text,_ParallaxHeightMap
+_ParallaxHeightMap_tooltip,
+_ParallaxStrength_text,_ParallaxStrength
+_ParallaxStrength_tooltip,
+_ParallaxInternalHeightmapMode_text,_ParallaxInternalHeightmapMode
+_ParallaxInternalHeightmapMode_tooltip,
+_ParallaxInternalHeightFromAlpha_text,_ParallaxInternalHeightFromAlpha
+_ParallaxInternalHeightFromAlpha_tooltip,
+_ParallaxInternalMap_text,_ParallaxInternalMap
+_ParallaxInternalMap_tooltip,
+_ParallaxInternalIterations_text,_ParallaxInternalIterations
+_ParallaxInternalIterations_tooltip,
+_ParallaxInternalMinDepth_text,_ParallaxInternalMinDepth
+_ParallaxInternalMinDepth_tooltip,
+_ParallaxInternalMaxDepth_text,_ParallaxInternalMaxDepth
+_ParallaxInternalMaxDepth_tooltip,
+_ParallaxInternalMinFade_text,_ParallaxInternalMinFade
+_ParallaxInternalMinFade_tooltip,
+_ParallaxInternalMaxFade_text,_ParallaxInternalMaxFade
+_ParallaxInternalMaxFade_tooltip,
+_ParallaxInternalMinColor_text,_ParallaxInternalMinColor
+_ParallaxInternalMinColor_tooltip,
+_ParallaxInternalMaxColor_text,_ParallaxInternalMaxColor
+_ParallaxInternalMaxColor_tooltip,
+_ParallaxInternalPanSpeed_text,_ParallaxInternalPanSpeed
+_ParallaxInternalPanSpeed_tooltip,
+_ParallaxInternalPanDepthSpeed_text,_ParallaxInternalPanDepthSpeed
+_ParallaxInternalPanDepthSpeed_tooltip,
+_ParallaxBias_text,_ParallaxBias
+_ParallaxBias_tooltip,
+_Cull_text,_Cull
+_Cull_tooltip,
+_ZTest_text,_ZTest
+_ZTest_tooltip,
+_SourceBlend_text,_SourceBlend
+_SourceBlend_tooltip,
+_DestinationBlend_text,_DestinationBlend
+_DestinationBlend_tooltip,
+_ZWrite_text,_ZWrite
+_ZWrite_tooltip,
+_ZBias_text,_ZBias
+_ZBias_tooltip,
+_IgnoreFog_text,_IgnoreFog
+_IgnoreFog_tooltip,
+Instancing_text,Instancing
+Instancing_tooltip,
+_StencilRef_text,_StencilRef
+_StencilRef_tooltip,
+_StencilPassOp_text,_StencilPassOp
+_StencilPassOp_tooltip,
+_StencilFailOp_text,_StencilFailOp
+_StencilFailOp_tooltip,
+_StencilZFailOp_text,_StencilZFailOp
+_StencilZFailOp_tooltip,
+_StencilCompareFunction_text,_StencilCompareFunction
+_StencilCompareFunction_tooltip,
+_DebugEnabled_text,_DebugEnabled
+_DebugEnabled_tooltip,
+_DebugMeshData_text,_DebugMeshData
+_DebugMeshData_tooltip,
+_DebugLightingData_text,_DebugLightingData
+_DebugLightingData_tooltip,
+_DebugSpecularData_text,_DebugSpecularData
+_DebugSpecularData_tooltip,
+_DebugCameraData_text,_DebugCameraData
+_DebugCameraData_tooltip,
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_locale.csv.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_locale.csv.meta
new file mode 100644
index 00000000..74080325
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/S_WireframeTransparent_PPT_locale.csv.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: f67dc3cefd5b31c4fb160eccfe8ba00e
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2.meta
new file mode 100644
index 00000000..518b45ae
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c8657f164c741ff4cbffb1781b86591f
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/PoiShatterHelpers.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/PoiShatterHelpers.cginc
new file mode 100644
index 00000000..e9f80a54
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/PoiShatterHelpers.cginc
@@ -0,0 +1,20 @@
+
+
+float2 getMatcapUV(float3 viewDirection, float3 normalDirection)
+{
+ half3 worldViewUp = normalize(half3(0, 1, 0) - viewDirection * dot(viewDirection, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(viewDirection, worldViewUp));
+ half2 matcapUV = half2(dot(worldViewRight, normalDirection), dot(worldViewUp, normalDirection)) * 0.5 + 0.5;
+ return matcapUV;
+}
+
+float3 CreateBinormal(float3 normal, float3 tangent, float binormalSign)
+{
+ return cross(normal, tangent.xyz) *
+ (binormalSign * unity_WorldTransformParams.w);
+}
+
+float random(in float3 st)
+{
+ return frac(cos(dot(st.xyz, float3(12.9898, 78.233, 123.691))) * 43758.5453123);
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/PoiShatterHelpers.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/PoiShatterHelpers.cginc.meta
new file mode 100644
index 00000000..86915e07
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/PoiShatterHelpers.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5bcdb4bafbb424d4c957bdde3305b07c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/Shatter.mat b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/Shatter.mat
new file mode 100644
index 00000000..516b3bf0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/Shatter.mat
@@ -0,0 +1,220 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: Shatter
+ m_Shader: {fileID: 4800000, guid: 53331eb0f5c357448b7969f013d8cf5f, type: 3}
+ m_ShaderKeywords:
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap: {}
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _AdditiveRamp:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 2, y: 2}
+ m_Offset: {x: 0, y: 0}
+ - _CubeMap:
+ m_Texture: {fileID: 8900000, guid: a0fde614a95c2d44ca3dec1fba756a6f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Matcap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MatcapMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Ramp:
+ m_Texture: {fileID: 2800000, guid: 2b2456e68290a8847a6903bc0005d58f, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RimTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RoughnessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecularMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _UnderWaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 20, y: 20}
+ m_Offset: {x: 0, y: 0}
+ - _WaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _AddMatcap: 0
+ - _AdditiveClearCoat: 0
+ - _AdditiveOffset: 0
+ - _AdditiveSoftness: 0.05
+ - _BumpScale: 0.28
+ - _Clip: 0.5
+ - _Cull: 2
+ - _Cutoff: 0.5
+ - _Desaturation: 0
+ - _DestinationBlend: 10
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _EmissionStrength: 0
+ - _EmissiveBlink_Max: 1
+ - _EmissiveBlink_Min: 1
+ - _EmissiveBlink_Velocity: 4
+ - _EmissiveScroll_Interval: 20
+ - _EmissiveScroll_Velocity: 10
+ - _EmissiveScroll_Width: 10
+ - _FlatOrFullAmbientLighting: 0
+ - _ForceLightDirection: 0
+ - _ForceShadowStrength: 0
+ - _Gloss: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0.5
+ - _GlossyReflections: 1
+ - _HardSpecular: 0
+ - _HeightThreshold: 0.944
+ - _MatcapStrength: 1
+ - _MaxDirectionalIntensity: 1
+ - _Metallic: 1
+ - _MinBrightness: 0
+ - _Mode: 0
+ - _MultiplyMatcap: 0
+ - _OcclusionStrength: 1
+ - _OutlineStencilCompareFunction: 8
+ - _OutlineStencilFailOp: 0
+ - _OutlineStencilPassOp: 0
+ - _OutlineStencilReadMaskRef: 0
+ - _OutlineStencilRef: 0
+ - _OutlineStencilWriteMaskRef: 0
+ - _OutlineStencilZFailOp: 0
+ - _Parallax: 0.02
+ - _PurelyAdditive: 0
+ - _ReplaceWithMatcap: 0
+ - _RimLightColorBias: 0
+ - _RimSharpness: 0.25
+ - _RimStrength: 0
+ - _RimWidth: 0.8
+ - _Roughness: 1
+ - _SampleWorld: 0
+ - _ScrollingEmission: 0
+ - _ShadowOffset: 0
+ - _ShadowStrength: 1
+ - _ShowUnderWave: 1
+ - _SmoothnessTextureChannel: 0
+ - _SourceBlend: 5
+ - _SpecularBias: 0
+ - _SpecularHighlights: 1
+ - _SpecularSize: 0.005
+ - _SpecularStrength: 0
+ - _SrcBlend: 1
+ - _StencilCompareFunction: 8
+ - _StencilFailOp: 0
+ - _StencilPassOp: 0
+ - _StencilReadMaskRef: 0
+ - _StencilRef: 0
+ - _StencilWriteMaskRef: 0
+ - _StencilZFailOp: 0
+ - _UVSec: 0
+ - _UnderWaveEmission: 3
+ - _WaveEmission: 0
+ - _WaveHeight: 0.03
+ - _ZTest: 4
+ - _ZWrite: 1
+ - footer_discord: 0
+ - footer_donate: 0
+ - footer_github: 0
+ - footer_patreon: 0
+ - m_StencilPassOptions: 0
+ - m_emissionOptions: 0
+ - m_end_OutlineStencil: 0
+ - m_end_blinkingEmissionOptions: 0
+ - m_end_mainAdvanced: 0
+ - m_end_scrollingEmissionOptions: 0
+ - m_fakeLightingOptions: 0
+ - m_mainOptions: 1
+ - m_matcapOptions: 0
+ - m_metallicOptions: 1
+ - m_miscOptions: 0
+ - m_rimLightOptions: 0
+ - m_shatterWave: 0
+ - m_specularHighlightsOptions: 0
+ - m_start_OutlineStencil: 0
+ - m_start_blinkingEmissionOptions: 0
+ - m_start_mainAdvanced: 0
+ - m_start_scrollingEmissionOptions: 0
+ - shader_is_using_thry_editor: 69.12
+ - shader_master_label: 0
+ - shader_presets: 0
+ m_Colors:
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+ - _EmissionScrollSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _EmissiveScroll_Direction: {r: 0, g: -10, b: 0, a: 0}
+ - _LightDirection: {r: 0, g: 1, b: 0, a: 0}
+ - _MatcapColor: {r: 1, g: 1, b: 1, a: 1}
+ - _RimLightColor: {r: 1, g: 1, b: 1, a: 1}
+ - _RimTexPanSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
+ - _WaveColor: {r: 1, g: 1, b: 1, a: 1}
+ - _WaveDensity: {r: 10, g: 8, b: 9, a: 0}
+ - _WaveSlope: {r: 2, g: 2, b: 2, a: 0}
+ - _WaveSpeed: {r: 0.5, g: 0.6, b: 0.7, a: 0}
+ - _underWaveColor: {r: 1, g: 0.47586215, b: 0, a: 1}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/Shatter.mat.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/Shatter.mat.meta
new file mode 100644
index 00000000..39734e33
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/Shatter.mat.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bb9bb81b164ff1b4d8a18130851a284d
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterPass.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterPass.cginc
new file mode 100644
index 00000000..ea28b3e8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterPass.cginc
@@ -0,0 +1,517 @@
+
+#if !defined(MY_LIGHTING_INCLUDED)
+ #define MY_LIGHTING_INCLUDED
+
+ #include "UnityCG.cginc"
+ #include "Lighting.cginc"
+ #include "UnityPBSLighting.cginc"
+ #include "AutoLight.cginc"
+ #include "PoiShatterHelpers.cginc"
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float2 texcoord: TEXCOORD0;
+ float2 texcoord1: TEXCOORD1;
+ };
+
+ struct v2g
+ {
+ float2 uv: TEXCOORD0;
+ float3 normal: TEXCOORD1;
+ #if defined(BINORMAL_PER_FRAGMENT)
+ float4 tangent: TEXCOORD2;
+ #else
+ float3 tangent: TEXCOORD2;
+ float3 binormal: TEXCOORD3;
+ #endif
+ float4 pos: SV_POSITION;
+ float4 worldPos: TEXCOORD4;
+ float4 localPos: TEXCOORD5;
+ SHADOW_COORDS(6)
+ };
+
+ struct g2f
+ {
+ float2 uv: TEXCOORD0;
+ float3 normal: TEXCOORD1;
+ #if defined(BINORMAL_PER_FRAGMENT)
+ float4 tangent: TEXCOORD2;
+ #else
+ float3 tangent: TEXCOORD2;
+ float3 binormal: TEXCOORD3;
+ #endif
+ float4 pos: SV_POSITION;
+ float4 worldPos: TEXCOORD4;
+ float4 localPos: TEXCOORD5;
+ float4 waveSettings: TEXCOORD6;
+ SHADOW_COORDS(7)
+ };
+
+ //Properties
+ float4 _Color;
+ float _Desaturation;
+ sampler2D _MainTex; float4 _MainTex_ST;
+ sampler2D _BumpMap; float4 _BumpMap_ST;
+ sampler2D _DetailNormalMap; float4 _DetailNormalMap_ST;
+ float _BumpScale;
+ float _DetailNormalMapScale;
+
+ sampler2D _WaveTexture; float4 _WaveTexture_ST;
+ sampler2D _UnderWaveTexture; float4 _UnderWaveTexture_ST;
+ float _ShowUnderWave;
+ float4 _WaveSpeed;
+ float4 _WaveSlope;
+ float4 _WaveDensity;
+
+ float _HeightThreshold;
+ float4 _WaveColor;
+ float _WaveEmission;
+ float _UnderWaveEmission;
+ float4 _underWaveColor;
+ float _WaveHeight;
+
+ samplerCUBE _CubeMap;
+ float _SampleWorld;
+ float _AdditiveClearCoat;
+ float _PurelyAdditive;
+ sampler2D _MetallicMap; float4 _MetallicMap_ST;
+ float _Metallic;
+ sampler2D _RoughnessMap; float4 _RoughnessMap_ST;
+ float _Roughness;
+
+ sampler2D _Matcap;
+ sampler2D _MatcapMap; float4 _MatcapMap_ST;
+ float4 _MatcapColor;
+ float _MatcapStrength;
+ float _ReplaceWithMatcap;
+ float _MultiplyMatcap;
+ float _AddMatcap;
+
+ sampler2D _SpecularMap; float4 _SpecularMap_ST;
+ float _Gloss;
+ float4 _EmissionColor;
+ sampler2D _EmissionMap; float4 _EmissionMap_ST;
+ sampler2D _EmissionMask; float4 _EmissionMask_ST;
+ float _EmissionStrength;
+
+ float4 _EmissiveScroll_Direction;
+ float4 _EmissionScrollSpeed;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _ScrollingEmission;
+
+ sampler2D _Ramp;
+ float _ForceLightDirection;
+ float _ShadowStrength;
+ float _ShadowOffset;
+ float3 _LightDirection;
+ float _ForceShadowStrength;
+ float _MinBrightness;
+ float _MaxDirectionalIntensity;
+ sampler2D _AdditiveRamp;
+ float _FlatOrFullAmbientLighting;
+
+ float4 _SpecularColor;
+ float _SpecularBias;
+ float _SpecularStrength;
+ float _SpecularSize;
+ float _HardSpecular;
+
+ float4 _RimLightColor;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimLightColorBias;
+ float4 _RimTexPanSpeed;
+ sampler2D _RimTex; float4 _RimTex_ST;
+
+ float _Clip;
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1));
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ v2g vert(appdata v)
+ {
+ v2g o;
+ TANGENT_SPACE_ROTATION;
+ o.localPos = v.vertex;
+ o.pos = UnityObjectToClipPos(v.vertex);
+ o.worldPos = mul(unity_ObjectToWorld, v.vertex);
+ o.uv = v.texcoord.xy;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(BINORMAL_PER_FRAGMENT)
+ o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
+ #else
+ o.tangent = UnityObjectToWorldDir(v.tangent.xyz);
+ o.binormal = CreateBinormal(o.normal, o.tangent, v.tangent.w);
+ #endif
+
+ TRANSFER_SHADOW(i);
+ return o;
+ }
+
+ float3 WaveHeight(float3 position)
+ {
+ return(sin(
+ 2 * pow(((sin((position.x + _Time.x * _WaveSpeed.x) * _WaveDensity.x + sin(_Time.y * _WaveSpeed.x)) + 1) / 2), _WaveSlope.x) +
+ 2 * pow(((sin((position.y + _Time.x * _WaveSpeed.y) * _WaveDensity.y + sin(_Time.y * _WaveSpeed.y)) + 1) / 2), _WaveSlope.y) +
+ 2 * pow(((sin((position.z + _Time.x * _WaveSpeed.z) * _WaveDensity.z + sin(_Time.y * _WaveSpeed.z)) + 1) / 2), _WaveSlope.z)
+ ) + 1) / 2;
+ }
+
+ [maxvertexcount(6)]
+ void geom(triangle v2g IN[3], inout TriangleStream < g2f > tristream)
+ {
+ float4 mid = (IN[0].localPos + IN[1].localPos + IN[2].localPos) / 3;
+ float4 objectPosition = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ float4 WavePosition = objectPosition;
+
+ float hash = random(mid);
+
+ float distanceToWave = clamp(WaveHeight(mid.xyz), 0, 1);
+ if (distanceToWave <= _HeightThreshold)
+ {
+ distanceToWave = 0;
+ }
+
+ float range = 1 - _HeightThreshold;
+ float delta = 1 - distanceToWave;
+ float percent = delta / range;
+ percent = saturate(percent);
+
+ if(percent == 0)
+ return;
+
+ g2f o;
+ g2f milk[3];
+ float count = 0;
+
+ float3 edgeA = IN[1].localPos - IN[0].localPos;
+ float3 edgeB = IN[2].localPos - IN[0].localPos;
+ float3 c = cross(edgeA, edgeB);
+ float3 outDir = normalize(c);
+ float3 normalDir = normalize(c);
+ float4 pos = float4(0, 0, 0, 0);
+
+ float3 over = cos(IN[1].localPos * 1234.56);
+ for (int i = 0; i < 3; i ++)
+ {
+ if(percent < .5)
+ {
+ over = normalize(over);
+ pos.xyz = (lerp(over, 0, percent * 2) + normalDir) * _WaveHeight;
+ }
+ else
+ {
+ pos.xyz = normalDir * _WaveHeight * (1 - percent) * 2 ;
+ }
+ o.localPos = IN[i].localPos + pos;
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ o.pos = UnityObjectToClipPos(IN[i].localPos + pos);
+ o.uv = IN[i].uv;
+ // r = wave height percentage
+ // g = isUnderside?
+ o.waveSettings = float4(0, 0, 0, 0);
+
+ o.normal = IN[i].normal;
+ #if defined(BINORMAL_PER_FRAGMENT)
+ o.tangent = IN[i].tangent;
+ #else
+ o.tangent = IN[i].tangent;
+ o.binormal = IN[i].binormal;
+ #endif
+
+ if (distanceToWave > 0)
+ {
+ o.waveSettings = float4(1-percent, 0, 0, 0);
+
+ milk[i].binormal = IN[i].binormal;
+ milk[i].localPos = IN[i].localPos;
+ milk[i].normal = IN[i].normal;
+ milk[i].pos = IN[i].pos;
+ milk[i].tangent = IN[i].tangent;
+ milk[i].uv = IN[i].uv;
+ if(distanceToWave > 0)
+ {
+ milk[i].waveSettings = float4(1-percent, 1, 0, 0);
+ }
+ milk[i].worldPos = IN[i].worldPos;
+ count ++ ;
+ }
+ tristream.Append(o);
+ }
+ if(_ShowUnderWave)
+ {
+ tristream.RestartStrip();
+ if(count == 3)
+ {
+ for (int i = 0; i < 3; i ++)
+ {
+ for (int i = 0; i < 3; i ++)
+ {
+ tristream.Append(milk[i]);
+ }
+ }
+ }
+ }
+ tristream.RestartStrip();
+ }
+
+ void InitializeFragmentNormal(inout g2f i)
+ {
+ float3 mainNormal = UnpackScaleNormal(tex2D(_BumpMap, TRANSFORM_TEX(i.uv, _BumpMap)), _BumpScale);
+ float3 detailNormal = UnpackScaleNormal(tex2D(_DetailNormalMap, TRANSFORM_TEX(i.uv, _DetailNormalMap)), _DetailNormalMapScale);
+ float3 tangentSpaceNormal = BlendNormals(mainNormal, detailNormal);
+
+ #if defined(BINORMAL_PER_FRAGMENT)
+ float3 binormal = CreateBinormal(i.normal, i.tangent.xyz, i.tangent.w);
+ #else
+ float3 binormal = i.binormal;
+ #endif
+
+ i.normal = normalize(
+ tangentSpaceNormal.x * i.tangent +
+ tangentSpaceNormal.y * binormal +
+ tangentSpaceNormal.z * i.normal
+ );
+ }
+
+ float4 frag(g2f i, float facing: VFACE): SV_Target
+ {
+ float Pi = 3.141592654;
+ #ifdef FORWARD_BASE_PASS
+ float3 _light_direction_var = normalize(_LightDirection);
+ if(!any(_WorldSpaceLightPos0) == 0 && _ForceLightDirection == 0)
+ {
+
+ _light_direction_var = _WorldSpaceLightPos0;
+ }
+ #else
+ #if defined(POINT) || defined(SPOT)
+ float3 _light_direction_var = normalize(_WorldSpaceLightPos0.xyz - i.worldPos);
+ #elif defined(DIRECTIONAL)
+ return 0;
+ float3 _light_direction_var = _WorldSpaceLightPos0;
+ #endif
+ #endif
+
+ // diffuse
+ float4 _main_tex_var = tex2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex));
+ float4 _diffuse_var = float4(lerp(_main_tex_var.rgb, dot(_main_tex_var.rgb, float3(0.3, 0.59, 0.11)), _Desaturation) * _Color.rgb, _main_tex_var.a * _Color.a);
+ float4 _underwave_tex_var = tex2D(_UnderWaveTexture, TRANSFORM_TEX(i.uv, _UnderWaveTexture)) * _underWaveColor;
+
+ // cutout
+ #ifndef TRANSPARENT
+ clip(_diffuse_var.a - _Clip);
+ #endif
+
+ // shatterDiffuse
+ float4 _wave_tex_var = tex2D(_WaveTexture, TRANSFORM_TEX(i.uv, _WaveTexture)) * _WaveColor;
+ if (i.waveSettings.r > 0)
+ {
+ _diffuse_var = lerp(_diffuse_var, _wave_tex_var, i.waveSettings.r);
+ }
+ // math
+ InitializeFragmentNormal(i);
+ float3 _camera_to_vert_var = normalize(getCameraPosition() - i.worldPos);
+ float3 _camera_to_vert_vr_var = normalize(_WorldSpaceCameraPos - i.worldPos);
+ float3 _camera_vert_dot_var = abs(dot(_camera_to_vert_var, i.normal));
+
+ // metal
+ float _metallic_map_var = tex2D(_MetallicMap, TRANSFORM_TEX(i.uv, _MetallicMap));
+ float _final_metalic_var = _metallic_map_var * _Metallic;
+ float _roughness_map_var = tex2D(_RoughnessMap, TRANSFORM_TEX(i.uv, _RoughnessMap));
+ float roughness = (1 - _final_metalic_var * _Roughness * _roughness_map_var);
+ roughness *= 1.7 - 0.7 * roughness;
+ float3 reflectedDir = reflect(-_camera_to_vert_vr_var, i.normal);
+ float3 reflection = float3(0, 0, 0);
+
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ //Probe 1
+ float4 reflectionData0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 reflectionColor0 = DecodeHDR(reflectionData0, unity_SpecCube0_HDR);
+
+ //Probe 2
+ float4 reflectionData1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 reflectionColor1 = DecodeHDR(reflectionData1, unity_SpecCube1_HDR);
+
+ reflection = lerp(reflectionColor1, reflectionColor0, interpolator);
+ }
+ else
+ {
+ float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ reflection = DecodeHDR(reflectionData, unity_SpecCube0_HDR);
+ }
+
+
+ bool no_probe = unity_SpecCube0_HDR.a == 0 && envSample.a == 0;
+ float lighty_boy_uwu_var = 0;
+ if (no_probe || _SampleWorld)
+ {
+ lighty_boy_uwu_var = 1;
+ reflection = texCUBElod(_CubeMap, float4(reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ }
+
+ // matcap / spehere textures
+ half2 matcapUV = getMatcapUV(_camera_to_vert_vr_var, i.normal);
+ float _matcapMap_var = tex2D(_MatcapMap, TRANSFORM_TEX(i.uv, _MatcapMap));
+ float3 _matcap_var = tex2D(_Matcap, matcapUV) * _MatcapColor * _MatcapStrength;
+
+ //rim lighting
+ float4 rimColor = tex2D(_RimTex, TRANSFORM_TEX(i.uv, _RimTex) + (_Time.y * _RimTexPanSpeed.xy)) * _RimLightColor;
+ float rim = pow((1 - _camera_vert_dot_var), (1 - _RimWidth) * 10);
+ _RimSharpness /= 2;
+ rim = (smoothstep(_RimSharpness, 1 - _RimSharpness, rim));
+
+ // lighting
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz);
+ float nDotL = dot(i.normal, _light_direction_var);
+ float fakeLight = clamp((nDotL + 1) / 2 + _ShadowOffset, 0, 1);
+ float4 LightingRamp = tex2D(_Ramp, float2(fakeLight, fakeLight));
+ #if defined(FORWARD_BASE_PASS)
+ //return float4(ShadeSH9(half4(0.0, 0.0, 0.0, 1.0)),1);
+ float3 _flat_lighting_var = 1;
+ float3 ambient = ShadeSH9(float4(i.normal * _FlatOrFullAmbientLighting, 1));
+ if (any(_LightColor0.rgb))
+ {
+ float4 lightZero = min(_LightColor0, _MaxDirectionalIntensity);
+
+ if(_ForceShadowStrength == 0)
+ {
+ _flat_lighting_var = ambient + lightZero.rgb * lerp(1, LightingRamp, _ShadowStrength);
+ _flat_lighting_var = clamp(_flat_lighting_var, _MinBrightness, max(lightZero.a, ambient));
+ }
+ else
+ {
+ _flat_lighting_var = (ambient + lightZero.rgb) * lerp(1, LightingRamp, _ShadowStrength);
+ _flat_lighting_var = clamp(_flat_lighting_var, _MinBrightness, max(lightZero.a, ambient));
+ }
+ }
+ else
+ {
+ _flat_lighting_var = clamp(ambient + ambient * lerp(1, LightingRamp, _ShadowStrength) - ambient * (_ShadowStrength * lerp(.75, 1, _ForceShadowStrength)), _MinBrightness, ambient);
+ }
+ //return float4(_flat_lighting_var, 1);
+ #else
+ float3 _flat_lighting_var = _LightColor0.rgb * attenuation * tex2D(_AdditiveRamp, .5 * nDotL + .5);
+ #endif
+
+
+
+ // emission
+ float4 _Emissive_Tex_var = tex2D(_EmissionMap, TRANSFORM_TEX(i.uv, _EmissionMap) + _Time.y * _EmissionScrollSpeed);
+ ///
+ float4 _emission_var = _Emissive_Tex_var * _EmissionColor * _EmissionStrength;
+
+ // scrolling emission
+ if (_ScrollingEmission == 1)
+ {
+ float phase = dot(i.localPos, _EmissiveScroll_Direction);
+ phase -= _Time.y * _EmissiveScroll_Velocity;
+ phase /= _EmissiveScroll_Interval;
+ phase -= floor(phase);
+ float width = _EmissiveScroll_Width;
+ phase = (pow(phase, width) + pow(1 - phase, width * 4)) * 0.5;
+ _emission_var *= phase;
+ }
+
+
+
+ // blinking emission
+ float amplitude = (_EmissiveBlink_Max - _EmissiveBlink_Min) * 0.5f;
+ float base = _EmissiveBlink_Min + amplitude;
+ float emissiveBlink = sin(_Time.y * _EmissiveBlink_Velocity) * amplitude + base;
+ _emission_var *= emissiveBlink;
+
+ float _Emission_mask_var = tex2D(_EmissionMask, TRANSFORM_TEX(i.uv, _EmissionMask));
+ _emission_var *= _Emission_mask_var;
+
+ // add it all up
+ float4 finalColor = _diffuse_var;
+
+ float3 _rim_color_var = lerp(finalColor.rgb, rimColor, _RimLightColorBias);
+
+ finalColor.rgb = lerp(finalColor.rgb, _rim_color_var, rim * _RimLightColor.a * rimColor.a);
+
+
+ finalColor.rgb = lerp(finalColor, _matcap_var, _ReplaceWithMatcap * _matcapMap_var);
+ finalColor.rgb *= lerp(1, _matcap_var, _MultiplyMatcap * _matcapMap_var);
+ finalColor.rgb += _matcap_var * _AddMatcap * _matcapMap_var;
+ float4 finalColorBeforeLighting = finalColor;
+
+ finalColor.rgb *= _flat_lighting_var;
+ #ifdef FORWARD_BASE_PASS
+ float3 finalreflections = reflection.rgb * lerp(finalColorBeforeLighting.rgb, 1, _PurelyAdditive);
+ finalColor.rgb = finalColor.rgb * lerp((1 - _final_metalic_var), 1, _AdditiveClearCoat);
+ finalColor.rgb += (finalreflections * ((1 - roughness + _final_metalic_var) / 2)) * lerp(1, _flat_lighting_var, lighty_boy_uwu_var);
+ #endif
+ // specular
+ #if (defined(POINT) || defined(SPOT))
+ _SpecularColor.rgb = _LightColor0.rgb;
+ _SpecularBias = 0;
+ #endif
+ float specular_map_var = tex2D(_SpecularMap, TRANSFORM_TEX(i.uv, _SpecularMap));
+ float3 specularColor = ((finalColor.a * _SpecularStrength) * lerp(finalColor.rgb * _LightColor0.rgb, _SpecularColor.rgb, _SpecularBias));
+ float specPow = exp2(_Gloss * 20.0 + 1.0);
+ float normTerm = (specPow + 10) / (10 * Pi);
+ float3 halfDirection = normalize(_camera_to_vert_vr_var + _light_direction_var);
+ float3 _specular_var = float3(0, 0, 0);
+ if(_HardSpecular == 1)
+ {
+ _specular_var = step(1 - (.5 * dot(halfDirection, i.normal) + .5), _SpecularSize) * _SpecularColor * _SpecularBias * specular_map_var;
+ }
+ else
+ {
+ _specular_var = pow(max(0, dot(halfDirection, i.normal)), specPow) * normTerm * specularColor * _SpecularStrength * specular_map_var;
+ }
+
+ #if defined(FORWARD_BASE_PASS)
+ finalColor.rgb += _specular_var * _flat_lighting_var;
+ finalColor.rgb += lerp(_emission_var, _wave_tex_var * _WaveEmission, i.waveSettings.r) + ((rim * _rim_color_var * _RimStrength) * rimColor.a);
+ if(i.waveSettings.g > 0)
+ {
+ finalColor.rgb = _underwave_tex_var.rgb * _flat_lighting_var;
+ finalColor.rgb += _underwave_tex_var.rgb * _UnderWaveEmission;
+ }
+ #else
+ finalColor.rgb += _specular_var;
+ #endif
+
+ #if(defined(POINT) || defined(SPOT))
+ finalColor *= (1 - _final_metalic_var);
+ #endif
+
+ return finalColor;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterPass.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterPass.cginc.meta
new file mode 100644
index 00000000..2ba6772c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterPass.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 236d1f882f98e3a4dbe00bdcb170aee6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterWave2.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterWave2.shader
new file mode 100644
index 00000000..934eb6db
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterWave2.shader
@@ -0,0 +1,264 @@
+Shader ".poiyomi/Patreon/ShatterWave2"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor("", Float)=0
+
+ [HideInInspector] shader_master_label("<color=#008080>❤ Poiyomi Shatter Wave V2.0 ❤</color>", Float) = 0
+ [HideInInspector] shader_presets("poiToonPresets", Float) = 0
+
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color", Color) = (1, 1, 1, 1)
+ _Desaturation ("Desaturation", Range(-1, 1)) = 0
+ _MainTex ("Texture", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("Tex UV#", Int) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.5
+ [HideInInspector] m_start_mainAdvanced ("Advanced", Float) = 0
+ [Normal]_DetailNormalMap ("Detail Map", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Intensity", Range(0, 10)) = 1
+ [HideInInspector] m_end_mainAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_shatterWave ("Shatter Wave", Float) = 0
+ [ToggleUI]_ShowUnderWave ("Show Under Wave?", Range(0, 1)) = 1
+ _WaveColor ("Wave Color", Color) = (1,1,1,1)
+ _WaveTexture ("Wave Texture", 2D) = "white" {}
+ _WaveEmission ("Wave Emission", Range(0, 10)) = 2
+ _underWaveColor ("Under Wave Color", Color) = (1,1,1,1)
+ _UnderWaveTexture ("Under Wave Texture", 2D) = "white" {}
+ _UnderWaveEmission ("Under Wave Emission", Range(0, 10)) = 2
+ _WaveSpeed ("Wave Speed X Y Z", Vector) = (.5,.6,.7,0)
+ _WaveSlope ("Wave Slope X Y Z", Vector) = (2,2,2,0)
+ _WaveDensity ("Wave Density X Y Z", Vector) = (10,8,9,0)
+ _HeightThreshold ("WaveWidth", Range(0, 1)) = .98
+ _WaveHeight ("Wave Height", Range(0,50)) = .01
+
+ [HideInInspector] m_metallicOptions ("Metallic", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _AdditiveClearCoat ("Additive Clear Coat", Range(0, 1)) = 0
+ _PurelyAdditive ("Purely Additive", Range(0, 1)) = 0
+ _MetallicMap ("Metallic Map", 2D) = "white" { }
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _RoughnessMap ("Roughness Map", 2D) = "white" { }
+ _Roughness ("Smoothness", Range(0, 1)) = 0
+
+ [HideInInspector] m_matcapOptions ("Matcap / Sphere Textures", Float) = 0
+ _Matcap ("Matcap", 2D) = "white" { }
+ _MatcapMap ("Matcap Map", 2D) = "white" { }
+ _MatcapColor ("Matcap Color", Color) = (1, 1, 1, 1)
+ _MatcapStrength ("Matcap Strength", Range(0, 20)) = 1
+ _ReplaceWithMatcap ("Replace With Matcap", Range(0, 1)) = 0
+ _MultiplyMatcap ("Multiply Matcap", Range(0, 1)) = 0
+ _AddMatcap ("Add Matcap", Range(0, 1)) = 0
+
+ [HideInInspector] m_emissionOptions ("Emission", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ _EmissionMap ("Emission Map", 2D) = "white" { }
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ _EmissionScrollSpeed ("Emission Scroll Speed", Vector) = (0, 0, 0, 0)
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ [HideInInspector] m_fakeLightingOptions ("Lighting", Float) = 0
+ [NoScaleOffset]_Ramp ("Lighting Ramp", 2D) = "white" { }
+ _ShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ _ShadowOffset ("Shadow Offset", Range(-1, 1)) = 0
+ [ToggleUI] _ForceLightDirection ("Force Light Direction", Range(0, 1)) = 0
+ [ToggleUI] _ForceShadowStrength ("Force Shadow Strength", Range(0, 1)) = 0
+ _LightDirection ("Fake Light Direction", Vector) = (0, 1, 0, 0)
+ _MinBrightness ("Min Brightness", Range(0, 1)) = 0
+ _MaxDirectionalIntensity ("Max Directional Intensity", Float) = 1
+ [NoScaleOffset]_AdditiveRamp ("Additive Ramp", 2D) = "white" { }
+ _FlatOrFullAmbientLighting ("Flat or Full Ambient Lighting", Range(0, 1)) = 0
+
+ [HideInInspector] m_specularHighlightsOptions ("Specular Highlights", Float) = 0
+ _SpecularMap ("Specular Map", 2D) = "white" { }
+ _Gloss ("Glossiness", Range(0, 1)) = 0
+ _SpecularColor ("Specular Color", Color) = (1, 1, 1, 1)
+ _SpecularBias ("Specular Color Bias", Range(0, 1)) = 0
+ _SpecularStrength ("Specular Strength", Range(0, 5)) = 0
+ [ToggleUI]_HardSpecular ("Enable Hard Specular", Float) = 0
+ _SpecularSize ("Hard Specular Size", Range(0, 1)) = .005
+
+ [HideInInspector] m_rimLightOptions ("Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ _RimTexPanSpeed ("Rim Texture Pan Speed", Vector) = (0, 0, 0, 0)
+
+ [HideInInspector] m_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ [IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ [HideInInspector] m_miscOptions ("Misc", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ }
+
+ //originalEditorCustomEditor "PoiShatter"
+CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "RenderType" = "TransparentCutout" "Queue" = "AlphaTest" }
+
+
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMaskRef]
+ WriteMask [_StencilWriteMaskRef]
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ Cull [_Cull]
+ ZTest [_ZTest]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma geometry geom
+ #define FORWARD_BASE_PASS
+ #include "ShatterPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMaskRef]
+ WriteMask [_StencilWriteMaskRef]
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #pragma multi_compile DIRECTIONAL POINT SPOT
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "ShatterPass.cginc"
+ ENDCG
+
+ }
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMaskRef]
+ WriteMask [_StencilWriteMaskRef]
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ CGPROGRAM
+
+ #pragma target 5.0
+ #pragma multi_compile_shadowcaster
+ #pragma vertex MyShadowVertexProgram
+ #pragma fragment MyShadowFragmentProgram
+ #include "UnityCG.cginc"
+
+ struct VertexData {
+ float4 position : POSITION;
+ float3 normal : NORMAL;
+ };
+
+ #if defined(SHADOWS_CUBE)
+ struct Interpolators {
+ float4 position : SV_POSITION;
+ float3 lightVec : TEXCOORD0;
+ };
+
+ Interpolators MyShadowVertexProgram (VertexData v) {
+ Interpolators i;
+ i.position = UnityObjectToClipPos(v.position);
+ i.lightVec =
+ mul(unity_ObjectToWorld, v.position).xyz - _LightPositionRange.xyz;
+ return i;
+ }
+
+ float4 MyShadowFragmentProgram (Interpolators i) : SV_TARGET {
+ float depth = length(i.lightVec) + unity_LightShadowBias.x;
+ depth *= _LightPositionRange.w;
+ return UnityEncodeCubeShadowDepth(depth);
+ }
+ #else
+ float4 MyShadowVertexProgram (VertexData v) : SV_POSITION {
+ float4 position =
+ UnityClipSpaceShadowCasterPos(v.position.xyz, v.normal);
+ return UnityApplyLinearShadowBias(position);
+ }
+
+ half4 MyShadowFragmentProgram () : SV_TARGET {
+ return 0;
+ }
+ #endif
+ ENDCG
+
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterWave2.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterWave2.shader.meta
new file mode 100644
index 00000000..03b7291a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/ShatterWave2/ShatterWave2.shader.meta
@@ -0,0 +1,22 @@
+fileFormatVersion: 2
+guid: 53331eb0f5c357448b7969f013d8cf5f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {instanceID: 0}
+ - _BumpMap: {instanceID: 0}
+ - _CubeMap: {fileID: 8900000, guid: a0fde614a95c2d44ca3dec1fba756a6f, type: 3}
+ - _MetallicMap: {instanceID: 0}
+ - _RoughnessMap: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMap: {instanceID: 0}
+ - _OutlineTexture: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _Ramp: {fileID: 2800000, guid: 2b2456e68290a8847a6903bc0005d58f, type: 3}
+ - _AdditiveRamp: {fileID: 2800000, guid: 2b2456e68290a8847a6903bc0005d58f, type: 3}
+ - _SpecularMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Test.unity b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Test.unity
new file mode 100644
index 00000000..448bbe2d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Test.unity
@@ -0,0 +1,528 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 9
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
+ m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
+ m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 0
+ m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
+ m_SkyboxMaterial: {fileID: 2100000, guid: 0b462db0bc54dd744984c31d3024b7b8, type: 2}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 0.12160779, g: 0.08136517, b: 0.26395804, a: 1}
+ m_UseRadianceAmbientProbe: 0
+--- !u!157 &3
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 11
+ m_GIWorkflowMode: 0
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 1
+ m_LightmapEditorSettings:
+ serializedVersion: 10
+ m_Resolution: 2
+ m_BakeResolution: 40
+ m_AtlasSize: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 1
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 256
+ m_ReflectionCompression: 2
+ m_MixedBakeMode: 2
+ m_BakeBackend: 1
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 500
+ m_PVRBounces: 2
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVRFilteringMode: 1
+ m_PVRCulling: 1
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ShowResolutionOverlay: 1
+ m_LightingDataAsset: {fileID: 0}
+ m_UseShadowmask: 1
+--- !u!196 &4
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 2
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666667
+ manualTileSize: 0
+ tileSize: 256
+ accuratePlacement: 0
+ debug:
+ m_Flags: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &617651384
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 617651388}
+ - component: {fileID: 617651387}
+ - component: {fileID: 617651386}
+ - component: {fileID: 617651385}
+ m_Layer: 0
+ m_Name: Plane
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!64 &617651385
+MeshCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 617651384}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 3
+ m_Convex: 0
+ m_CookingOptions: 14
+ m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!23 &617651386
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 617651384}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 2100000, guid: 777227de76537f34bb1620a1e408305a, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &617651387
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 617651384}
+ m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!4 &617651388
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 617651384}
+ m_LocalRotation: {x: -0, y: 0.84758186, z: -0, w: -0.53066474}
+ m_LocalPosition: {x: -1.239, y: 0, z: 0.384}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 964.101, z: 0}
+--- !u!1 &1038036407
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1038036409}
+ - component: {fileID: 1038036408}
+ m_Layer: 0
+ m_Name: Directional Light
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!108 &1038036408
+Light:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1038036407}
+ m_Enabled: 1
+ serializedVersion: 8
+ m_Type: 1
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_Intensity: 1
+ m_Range: 10
+ m_SpotAngle: 30
+ m_CookieSize: 10
+ m_Shadows:
+ m_Type: 2
+ m_Resolution: -1
+ m_CustomResolution: -1
+ m_Strength: 1
+ m_Bias: 0.05
+ m_NormalBias: 0.4
+ m_NearPlane: 0.2
+ m_Cookie: {fileID: 0}
+ m_DrawHalo: 0
+ m_Flare: {fileID: 0}
+ m_RenderMode: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_Lightmapping: 4
+ m_LightShadowCasterMode: 0
+ m_AreaSize: {x: 1, y: 1}
+ m_BounceIntensity: 1
+ m_ColorTemperature: 6570
+ m_UseColorTemperature: 0
+ m_ShadowRadius: 0
+ m_ShadowAngle: 0
+--- !u!4 &1038036409
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1038036407}
+ m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
+ m_LocalPosition: {x: 1.0734956, y: 3.824, z: -4.0563307}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
+--- !u!1 &1214713238
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1214713243}
+ - component: {fileID: 1214713242}
+ - component: {fileID: 1214713241}
+ - component: {fileID: 1214713240}
+ - component: {fileID: 1214713239}
+ m_Layer: 8
+ m_Name: Main Camera
+ m_TagString: MainCamera
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &1214713239
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1214713238}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ sharedProfile: {fileID: 11400000, guid: 833499362f7a96e4cb78798e49c467b8, type: 2}
+ isGlobal: 1
+ blendDistance: 0
+ weight: 1
+ priority: 0
+--- !u!114 &1214713240
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1214713238}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ volumeTrigger: {fileID: 1214713243}
+ volumeLayer:
+ serializedVersion: 2
+ m_Bits: 256
+ stopNaNPropagation: 1
+ finalBlitToCameraTarget: 0
+ antialiasingMode: 0
+ temporalAntialiasing:
+ jitterSpread: 0.75
+ sharpness: 0.25
+ stationaryBlending: 0.95
+ motionBlending: 0.85
+ subpixelMorphologicalAntialiasing:
+ quality: 2
+ fastApproximateAntialiasing:
+ fastMode: 0
+ keepAlpha: 0
+ fog:
+ enabled: 1
+ excludeSkybox: 1
+ debugLayer:
+ lightMeter:
+ width: 512
+ height: 256
+ showCurves: 1
+ histogram:
+ width: 512
+ height: 256
+ channel: 3
+ waveform:
+ exposure: 0.12
+ height: 256
+ vectorscope:
+ size: 256
+ exposure: 0.12
+ overlaySettings:
+ linearDepth: 0
+ motionColorIntensity: 4
+ motionGridSize: 64
+ colorBlindnessType: 0
+ colorBlindnessStrength: 1
+ m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2}
+ m_ShowToolkit: 0
+ m_ShowCustomSorter: 0
+ breakBeforeColorGrading: 0
+ m_BeforeTransparentBundles: []
+ m_BeforeStackBundles: []
+ m_AfterStackBundles: []
+--- !u!81 &1214713241
+AudioListener:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1214713238}
+ m_Enabled: 1
+--- !u!20 &1214713242
+Camera:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1214713238}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_projectionMatrixMode: 1
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_GateFitMode: 2
+ m_FocalLength: 50
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+ near clip plane: 0.3
+ far clip plane: 1000
+ field of view: 60
+ orthographic: 0
+ orthographic size: 5
+ m_Depth: -1
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 0}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 1
+ m_AllowMSAA: 1
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 1
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!4 &1214713243
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1214713238}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 1, z: -10}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1600271716
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1600271720}
+ - component: {fileID: 1600271719}
+ - component: {fileID: 1600271718}
+ - component: {fileID: 1600271717}
+ m_Layer: 0
+ m_Name: Plane (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!64 &1600271717
+MeshCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1600271716}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 3
+ m_Convex: 0
+ m_CookingOptions: 14
+ m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!23 &1600271718
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1600271716}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 2100000, guid: addda95c230ffee4999dee5ae4ca8389, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &1600271719
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1600271716}
+ m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!4 &1600271720
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1600271716}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -0.38, y: 0.889, z: -0.083}
+ m_LocalScale: {x: 0.32804, y: 0.32804, z: 0.32804}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Test.unity.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Test.unity.meta
new file mode 100644
index 00000000..5573f235
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Test.unity.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ed94d2d9cf8a1db4eb20cc41e292222d
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy 1.png b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy 1.png
new file mode 100755
index 00000000..1f6cac7b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy 1.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy 1.png.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy 1.png.meta
new file mode 100644
index 00000000..8914cb10
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy 1.png.meta
@@ -0,0 +1,99 @@
+fileFormatVersion: 2
+guid: 9aaad3694c09a6c43940af28c0d0bfff
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 2
+ aniso: 16
+ mipBias: -100
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ - serializedVersion: 2
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy.png b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy.png
new file mode 100755
index 00000000..429e9b05
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy.png.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy.png.meta
new file mode 100644
index 00000000..b9b2b15f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Untitled-1 copy.png.meta
@@ -0,0 +1,99 @@
+fileFormatVersion: 2
+guid: 9282fbcd2d0de7649acd32e90dd0564e
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ - serializedVersion: 2
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video.meta
new file mode 100644
index 00000000..d46a6b5c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 680abcd9fde60064e9c60281ed9f712b
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures.meta
new file mode 100644
index 00000000..290c4456
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 4eb87c9596863f948b14c4df745939f8
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/GameboyRamp.png b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/GameboyRamp.png
new file mode 100755
index 00000000..621b8ea7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/GameboyRamp.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/GameboyRamp.png.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/GameboyRamp.png.meta
new file mode 100644
index 00000000..d81252c3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/GameboyRamp.png.meta
@@ -0,0 +1,86 @@
+fileFormatVersion: 2
+guid: e7f37a344ed1e5d43ab9257d571c4f79
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 4
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 0
+ aniso: -1
+ mipBias: -1
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ - buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ spritePackingTag:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_CRT.png b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_CRT.png
new file mode 100755
index 00000000..8c9e6ec0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_CRT.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_CRT.png.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_CRT.png.meta
new file mode 100644
index 00000000..101c326a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_CRT.png.meta
@@ -0,0 +1,99 @@
+fileFormatVersion: 2
+guid: 0f531a1eb6e4f4c42bb9d82c735a782b
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 1
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 3
+ mipMapFadeDistanceEnd: 7
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: 0
+ wrapV: 0
+ wrapW: 0
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ - serializedVersion: 2
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_IPS.png b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_IPS.png
new file mode 100755
index 00000000..927bb437
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_IPS.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_IPS.png.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_IPS.png.meta
new file mode 100644
index 00000000..5b6a4251
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_IPS.png.meta
@@ -0,0 +1,99 @@
+fileFormatVersion: 2
+guid: 395778ad026bd4b4e9e825c52f71e3db
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 1
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 3
+ mipMapFadeDistanceEnd: 7
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ - serializedVersion: 2
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_LCD.png b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_LCD.png
new file mode 100755
index 00000000..0f19462d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_LCD.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_LCD.png.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_LCD.png.meta
new file mode 100644
index 00000000..ad22bad2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_LCD.png.meta
@@ -0,0 +1,99 @@
+fileFormatVersion: 2
+guid: 693451fbe00d3ed42844e3423d937768
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 1
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 3
+ mipMapFadeDistanceEnd: 7
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 1
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: 0
+ wrapV: 0
+ wrapW: 0
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ - serializedVersion: 2
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_OLED.png b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_OLED.png
new file mode 100755
index 00000000..17c9f20d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_OLED.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_OLED.png.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_OLED.png.meta
new file mode 100644
index 00000000..9ea9c5f3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/Video/Textures/PIX_OLED.png.meta
@@ -0,0 +1,99 @@
+fileFormatVersion: 2
+guid: a465ce0e4a29c2c40b68dbc3b3741026
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 1
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 3
+ mipMapFadeDistanceEnd: 7
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: 1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ - serializedVersion: 2
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed.meta
new file mode 100644
index 00000000..314cf74e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8c9e57c477675b04682152f43d6d0464
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes.meta
new file mode 100644
index 00000000..0e384408
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 05ca3d3f6b3c5984abd62db1ddc431ca
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiBasics.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiBasics.cginc
new file mode 100644
index 00000000..afce52ad
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiBasics.cginc
@@ -0,0 +1,60 @@
+#ifndef BASICS
+ #define BASICS
+
+ //Properties
+ float4 _Color;
+ float _Desaturation;
+ UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_BumpMap); float4 _BumpMap_ST;
+ float4 _GlobalPanSpeed;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DetailNormalMap); float4 _DetailNormalMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DetailNormalMask); float4 _DetailNormalMask_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_AlphaMask); float4 _AlphaMask_ST;
+ float _BumpScale;
+ float _DetailNormalMapScale;
+ float _Clip;
+
+ float3 viewDirection;
+ float viewDotNormal;
+ float4 mainTexture;
+ float alphaMask;
+ float4 albedo;
+
+ void InitializeFragmentNormal(inout v2f i)
+ {
+
+ float3 mainNormal = UnpackScaleNormal(UNITY_SAMPLE_TEX2D_SAMPLER(_BumpMap, _MainTex, TRANSFORM_TEX(i.uv, _BumpMap)), _BumpScale);
+ float detailNormalMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DetailNormalMask, _MainTex, TRANSFORM_TEX(i.uv, _DetailNormalMask));
+ float3 detailNormal = UnpackScaleNormal(UNITY_SAMPLE_TEX2D_SAMPLER(_DetailNormalMap, _MainTex, TRANSFORM_TEX(i.uv, _DetailNormalMap)), _DetailNormalMapScale * detailNormalMask);
+ float3 tangentSpaceNormal = BlendNormals(mainNormal, detailNormal);
+
+ #if defined(BINORMAL_PER_FRAGMENT)
+ float3 binormal = CreateBinormal(i.normal, i.tangent.xyz, i.tangent.w);
+ #else
+ float3 binormal = i.binormal;
+ #endif
+
+ i.normal = normalize(
+ tangentSpaceNormal.x * i.tangent +
+ tangentSpaceNormal.y * binormal +
+ tangentSpaceNormal.z * i.normal
+ );
+ }
+
+ void calculateBasics(inout v2f i)
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+ baseNormal = i.normal;
+
+ #ifndef DRAG_N_DROP
+ InitializeFragmentNormal(i);
+ #endif
+
+ viewDirection = normalize(_WorldSpaceCameraPos - i.worldPos);
+ viewDotNormal = abs(dot(viewDirection, i.normal));
+
+ mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex));
+ alphaMask = UNITY_SAMPLE_TEX2D_SAMPLER(_AlphaMask, _MainTex, TRANSFORM_TEX(i.uv, _AlphaMask));
+ albedo = float4(lerp(mainTexture.rgb, dot(mainTexture.rgb, float3(0.3, 0.59, 0.11)), _Desaturation) * _Color.rgb, mainTexture.a * _Color.a * alphaMask);
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiBasics.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiBasics.cginc.meta
new file mode 100644
index 00000000..638c2908
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiBasics.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: baf5af145e9eff4499da9c1b47119eec
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiData.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiData.cginc
new file mode 100644
index 00000000..7383892c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiData.cginc
@@ -0,0 +1,18 @@
+#ifndef DATA
+ #define DATA
+
+ struct PoiLighting
+ {
+ float3 direction;
+ float3 position;
+ float3 color;
+ float attenuation;
+ float3 directLighting;
+ float3 indirectLighting;
+ float lightMap;
+ float3 rampedLightMap;
+ float3 finalLighting;
+ float nDotL;
+ };
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiData.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiData.cginc.meta
new file mode 100644
index 00000000..8847efae
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiData.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f9c59d934064e36439e8b48450dd8fc9
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDefaultPass.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDefaultPass.cginc
new file mode 100644
index 00000000..364f46cb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDefaultPass.cginc
@@ -0,0 +1,20 @@
+#ifndef POI_DEFAULT_PASS
+ #define POI_DEFAULT_PASS
+
+ #include "Poicludes.cginc"
+ #include "PoiHelpers.cginc"
+ #include "PoiBasics.cginc"
+ #include "PoiEmission.cginc"
+ #include "PoiLighting.cginc"
+ #include "PoiFun.cginc"
+ #include "PoiRimlighting.cginc"
+ #include "PoiMetal.cginc"
+ #include "PoiMatcap.cginc"
+ #include "PoiSpecular.cginc"
+ #include "PoiSubsurfaceScattering.cginc"
+
+ #include "PoiVert.cginc"
+ #include "PoiFrag.cginc"
+ #include "PoiGeom.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDefaultPass.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDefaultPass.cginc.meta
new file mode 100644
index 00000000..96346d85
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDefaultPass.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e5b8c59f665242546a9251f482d54618
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDragNDropLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDragNDropLighting.cginc
new file mode 100644
index 00000000..82979ded
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDragNDropLighting.cginc
@@ -0,0 +1,100 @@
+#ifndef DND_LIGHTING
+ #define DND_LIGHTING
+
+ sampler2D _ToonRamp;
+ float _AdditiveSoftness;
+ float _AdditiveOffset;
+ float _ForceLightDirection;
+ float _ShadowStrength;
+ float _OutlineShadowStrength;
+ float _ShadowOffset;
+ float3 _LightDirection;
+ float _ForceShadowStrength;
+ float _CastedShadowSmoothing;
+ float _MinBrightness;
+ float _MaxBrightness;
+ float _IndirectContribution;
+ float _AttenuationMultiplier;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_AOMap); float4 _AOMap_ST;
+ float _AOStrength;
+
+ float3 ShadeSH9Indirect()
+ {
+ return ShadeSH9(half4(0.0, -1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Direct()
+ {
+ return ShadeSH9(half4(0.0, 1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Normal(float3 normalDirection)
+ {
+ return ShadeSH9(half4(normalDirection, 1.0));
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ x1.b = length(unity_SHBb);
+ return x + x1;
+ }
+
+ float FadeShadows(float attenuation, float3 worldPosition)
+ {
+ float viewZ = dot(_WorldSpaceCameraPos - worldPosition, UNITY_MATRIX_V[2].xyz);
+ float shadowFadeDistance = UnityComputeShadowFadeDistance(worldPosition, viewZ);
+ float shadowFade = UnityComputeShadowFade(shadowFadeDistance);
+ attenuation = saturate(attenuation + shadowFade);
+ return attenuation;
+ }
+
+ float calculateAOMap(float AOMap, float AOStrength)
+ {
+ return lerp(1, AOMap, AOStrength);
+ }
+
+ void calculateBasePassLighting(float3 normal, float2 uv)
+ {
+ poiLight.direction = _WorldSpaceLightPos0;
+ poiLight.nDotL = dot(normal, poiLight.direction);
+ float AOMap = 1;
+ #ifndef OUTLINE
+ AOMap = UNITY_SAMPLE_TEX2D_SAMPLER(_AOMap, _MainTex, TRANSFORM_TEX(uv, _AOMap));
+ AOMap = calculateAOMap(AOMap, _AOStrength);
+ #endif
+ poiLight.finalLighting = saturate((GetSHLength() + poiLight.color) * AOMap);
+ }
+
+ void calculateDNDLighting(v2f i)
+ {
+ #ifdef OUTLINE
+ _ShadowStrength = _OutlineShadowStrength;
+ #endif
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz)
+ poiLight.attenuation = FadeShadows(attenuation, i.worldPos.xyz);
+ poiLight.color = _LightColor0.rgb;
+ #ifdef FORWARD_BASE_PASS
+ calculateBasePassLighting(i.normal, i.uv);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.position = _WorldSpaceLightPos0.xyz;
+ poiLight.direction = normalize(poiLight.position - i.worldPos);
+ poiLight.nDotL = dot(i.normal, poiLight.direction);
+ poiLight.finalLighting = poiLight.color * poiLight.attenuation * smoothstep(.499, .5, .5 * poiLight.nDotL + .5);
+ #endif
+ #endif
+ }
+
+ void applyDNDLighting(inout float4 finalColor)
+ {
+ finalColor.rgb *= poiLight.finalLighting;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDragNDropLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDragNDropLighting.cginc.meta
new file mode 100644
index 00000000..1b94adcd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiDragNDropLighting.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 929b21dd7eb613f47bc07ab065883762
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiEmission.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiEmission.cginc
new file mode 100644
index 00000000..07c47016
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiEmission.cginc
@@ -0,0 +1,52 @@
+#ifndef EMISSION
+ #define EMISSION
+
+ float4 _EmissionColor;
+ sampler2D _EmissionMap; float4 _EmissionMap_ST;
+ sampler2D _EmissionMask; float4 _EmissionMask_ST;
+ float _EmissionStrength;
+
+ float4 _EmissiveScroll_Direction;
+ float4 _EmissionScrollSpeed;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _ScrollingEmission;
+
+ float4 emission = 0;
+
+ void calculateEmission(float2 uv, float3 localPos)
+ {
+ float4 _Emissive_Tex_var = tex2D(_EmissionMap, TRANSFORM_TEX(uv, _EmissionMap) + _Time.y * _EmissionScrollSpeed);
+ emission = _Emissive_Tex_var * _EmissionColor * _EmissionStrength;
+
+ // scrolling emission
+ if (_ScrollingEmission == 1)
+ {
+ float phase = dot(localPos, _EmissiveScroll_Direction);
+ phase -= _Time.y * _EmissiveScroll_Velocity;
+ phase /= _EmissiveScroll_Interval;
+ phase -= floor(phase);
+ float width = _EmissiveScroll_Width;
+ phase = (pow(phase, width) + pow(1 - phase, width * 4)) * 0.5;
+ emission *= phase;
+ }
+
+ // blinking emission
+ float amplitude = (_EmissiveBlink_Max - _EmissiveBlink_Min) * 0.5f;
+ float base = _EmissiveBlink_Min + amplitude;
+ float emissiveBlink = sin(_Time.y * _EmissiveBlink_Velocity) * amplitude + base;
+ emission *= emissiveBlink;
+
+ float _Emission_mask_var = tex2D(_EmissionMask, TRANSFORM_TEX(uv, _EmissionMask));
+ emission *= _Emission_mask_var;
+ }
+
+ void applyEmission(inout float4 finalColor)
+ {
+ finalColor.rgb += emission;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiEmission.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiEmission.cginc.meta
new file mode 100644
index 00000000..552c0295
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiEmission.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 47ebba48949726e48984026733ee5648
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFrag.cginc
new file mode 100644
index 00000000..7d277674
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFrag.cginc
@@ -0,0 +1,159 @@
+#ifndef POIFRAG
+ #define POIFRAG
+
+ int _CubeGradientDebug;
+
+ float4 frag(v2f i, float facing: VFACE): SV_Target
+ {
+ if (_CubeGradientDebug == 1)
+ {
+ float4 debugCol = frac(i.localPos.z);
+ if(debugCol.x <= 0.001)
+ {
+ debugCol.rgb = float3(1,0,0);
+ }
+ return debugCol;
+ }
+
+ #ifdef BASICS
+ calculateBasics(i);
+ #endif
+
+ #ifdef LIGHTING
+ calculateLighting(i);
+ #endif
+
+ #ifdef DND_LIGHTING
+ calculateDNDLighting(i);
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ #ifdef REFRACTION
+ calculateRefraction(i);
+ #endif
+ #endif
+
+ #ifdef METAL
+ calculateReflections(i.uv, i.normal, viewDirection);
+ #endif
+
+ #ifdef TEXTURE_BLENDING
+ calculateTextureBlending(blendAlpha, mainTexture, albedo, i.uv);
+ #endif
+
+ clip(mainTexture.a * alphaMask - _Clip);
+
+ #ifdef MATCAP
+ calculateMatcap(viewDirection, i.normal, i.uv);
+ #endif
+
+ #ifdef LIGHTING
+ #ifdef SUBSURFACE
+ calculateSubsurfaceScattering(i, viewDirection);
+ #endif
+ #endif
+
+ #ifdef RIM_LIGHTING
+ calculateRimLighting(i.uv, viewDotNormal);
+ #endif
+
+ #ifdef PANOSPHERE
+ calculatePanosphere(i.worldPos, i.uv);
+ #endif
+
+ #ifdef SCROLLING_LAYERS
+ calculateScrollingLayers(i.uv);
+ #endif
+
+ #ifdef EMISSION
+ calculateEmission(i.uv, i.localPos);
+ #endif
+
+ float4 finalColor = albedo;
+
+ #ifdef RIM_LIGHTING
+ applyRimColor(finalColor);
+ #endif
+
+ #ifdef MATCAP
+ applyMatcap(finalColor);
+ #endif
+
+ #ifdef PANOSPHERE
+ applyPanosphereColor(finalColor);
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ #ifdef REFRACTION
+ applyRefraction(finalColor);
+ #endif
+ #endif
+
+
+ float4 finalColorBeforeLighting = finalColor;
+
+ #ifdef LIGHTING
+ applyLighting(finalColor);
+ #endif
+
+ #ifdef DND_LIGHTING
+ applyDNDLighting(finalColor);
+ #endif
+
+ #ifdef METAL
+ applyReflections(finalColor, finalColorBeforeLighting);
+ #endif
+
+ #ifdef SPECULAR
+ calculateSpecular(i.normal, albedo, viewDirection, i.uv);
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ #ifdef LIGHTING
+ #ifdef SPECULAR
+ //applyLightingToSpecular();
+ applySpecular(finalColor);
+ #endif
+ #endif
+
+ #ifdef PANOSPHERE
+ applyPanosphereEmission(finalColor);
+ #endif
+
+ #ifdef EMISSION
+ applyEmission(finalColor);
+ #endif
+
+ #ifdef RIM_LIGHTING
+ ApplyRimEmission(finalColor);
+ #endif
+ #endif
+
+ #ifdef LIGHTING
+ #if (defined(POINT) || defined(SPOT))
+ #ifdef METAL
+ applyAdditiveReflectiveLighting(finalColor);
+ #endif
+ #ifdef TRANSPARENT
+ finalColor.rgb *= finalColor.a;
+ #endif
+
+ #ifdef SPECULAR
+ applySpecular(finalColor);
+ #endif
+ #endif
+ #endif
+
+ #ifdef LIGHTING
+ #ifdef SUBSURFACE
+ applySubsurfaceScattering(finalColor);
+ #endif
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_APPLY_FOG(i.fogCoord, finalColor);
+ #endif
+
+ return finalColor;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFrag.cginc.meta
new file mode 100644
index 00000000..5e3093b0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFrag.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a7be1d5beafa95c4eb95a33bd490f22f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFun.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFun.cginc
new file mode 100644
index 00000000..102f2f8e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFun.cginc
@@ -0,0 +1,62 @@
+#ifndef FUN
+ #define FUN
+
+ int _Mirror;
+
+ void applyFun(inout float4 vertex)
+ {
+ bool inMirror = IsInMirror();
+ UNITY_BRANCH
+ if (_Mirror == 0)
+ {
+ return;
+ }
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+
+ void applyFunFrag()
+ {
+ bool inMirror = IsInMirror();
+ UNITY_BRANCH
+ if(_Mirror == 0)
+ {
+ return;
+ }
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFun.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFun.cginc.meta
new file mode 100644
index 00000000..5fc6b222
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiFun.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f04ca200839efd84d96d09eb392df59a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiGeom.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiGeom.cginc
new file mode 100644
index 00000000..977eac1d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiGeom.cginc
@@ -0,0 +1,240 @@
+struct Cube
+{
+ float3 min;
+ float3 max;
+};
+
+float random(in float3 st)
+{
+ return frac(cos(dot(st.xyz, float3(12.9898, 78.233, 123.691))) * 43758.5453123);
+}
+
+float _TriToCube;
+float _SpawnAlpha;
+float3 _LocalSpawnOffset;
+float3 _WorldSpawnOffset;
+float _Pieces;
+int _AssemblyMode;
+float3 _AssemblyBegin;
+float3 _AssemblyEnd;
+int _ExplodeMode;
+float _ExplodeFadeDistance;
+
+void assembleVert(float3 newPos, v2f i, float2 newUV, float alpha, inout v2f o)
+{
+ float3 worldPos = lerp(i.worldPos, newPos, alpha);
+ o.uv = lerp(i.uv, newUV, _TriToCube);
+ o.pos = UnityWorldToClipPos(float4(worldPos, 1));
+ o.worldPos = float4(worldPos, 1);
+}
+
+[maxvertexcount(18)]
+void geom(triangle v2f IN[3], inout TriangleStream < v2f > tristream)
+{
+ float3 edgeA = IN[1].localPos - IN[0].localPos;
+ float3 edgeB = IN[2].localPos - IN[0].localPos;
+ float3 c = cross(edgeA, edgeB);
+ float3 outDir = normalize(c);
+
+ float4 center = (IN[0].worldPos + IN[1].worldPos + IN[2].worldPos) / 3;
+ float2 uv = (IN[0].uv + IN[1].uv + IN[2].uv) / 3;
+ Cube cube;
+ v2f o;
+
+ float rando = random(float3(IN[0].vertexId, IN[1].vertexId, IN[2].vertexId));
+ //center += rando/50;
+ // Calculate Cube Bounds
+ cube.min = IN[0].worldPos;
+ cube.max = IN[0].worldPos;
+ for (int i = 1; i < 3; i ++)
+ {
+ cube.min = float3(min(IN[i].worldPos.x, cube.min.x), min(IN[i].worldPos.y, cube.min.y), min(IN[i].worldPos.z, cube.min.z));
+ cube.max = float3(max(IN[i].worldPos.x, cube.max.x), max(IN[i].worldPos.y, cube.max.y), max(IN[i].worldPos.z, cube.max.z));
+ }
+ cube.min = lerp(cube.min, center, rando / 20);
+ cube.max = lerp(cube.max, center, rando / 20);
+ float4 offset = 0;
+ if (_ExplodeMode == 0)
+ {
+ offset = float4(_WorldSpawnOffset, 0) + mul(unity_ObjectToWorld, _LocalSpawnOffset);
+ }
+ else if(_ExplodeMode == 1)
+ {
+ offset = float4(outDir * _ExplodeFadeDistance, 0);
+ }
+
+ float4 cameraExplodeOffset = 0;
+
+ float spawnAlpha = 0;
+
+ if(_AssemblyMode == 0) // Random
+ {
+ spawnAlpha = saturate((-rando) * _Pieces + (_SpawnAlpha * (_Pieces + 1)));
+ }
+ else if (_AssemblyMode == 1) // Building Blocks
+ {
+ float lineMagnitude = distance(_AssemblyBegin, _AssemblyEnd);
+ float3 constructionLine = (_AssemblyEnd - _AssemblyBegin);
+ float3 objectLine = (mul(unity_WorldToObject, center) - _AssemblyBegin);
+ float progress = -1 + saturate(dot(constructionLine, objectLine) / (lineMagnitude * lineMagnitude));
+
+ IN[0].localPos.z = progress;
+ IN[1].localPos.z = progress;
+ IN[2].localPos.z = progress;
+
+ spawnAlpha = saturate((progress) * _Pieces + (_SpawnAlpha * (_Pieces + 1)));
+ }
+
+ cube.min = lerp(cube.min, center + offset, spawnAlpha);
+ cube.max = lerp(cube.max, center + offset, spawnAlpha);
+
+ // Construct Cubes
+ float3 normal = float3(0, 0, 1);
+ o = IN[0];
+ o.uv = lerp(o.uv, uv, _TriToCube);
+
+ IN[0].worldPos = lerp(IN[0].worldPos, center + offset, spawnAlpha);
+ IN[1].worldPos = lerp(IN[1].worldPos, center + offset, spawnAlpha);
+ IN[2].worldPos = lerp(IN[2].worldPos, center + offset, spawnAlpha);
+
+
+ if (_TriToCube == 0)
+ {
+ for (int i = 0; i < 3; i ++)
+ {
+ IN[i].pos = UnityWorldToClipPos(IN[i].worldPos);
+ tristream.Append(IN[i]);
+ }
+ tristream.RestartStrip();
+ return;
+ }
+
+ float3 viewDirection = normalize(center - getCameraPosition());
+
+ //Front
+ o.normal = float3(0, 0, 1);
+ if (dot(viewDirection, o.normal) < 0)
+ {
+ assembleVert(float3(cube.min.x, cube.min.y, cube.max.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.min.y, cube.max.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.max.y, cube.max.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ assembleVert(float3(cube.max.x, cube.max.y, cube.max.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.max.y, cube.max.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.min.y, cube.max.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ }
+
+ //Back
+ o.normal = float3(0, 0, -1);
+ if (dot(viewDirection, o.normal) < 0)
+ {
+ assembleVert(float3(cube.min.x, cube.max.y, cube.min.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.min.y, cube.min.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.min.y, cube.min.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ assembleVert(float3(cube.max.x, cube.min.y, cube.min.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.max.y, cube.min.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.max.y, cube.min.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ }
+
+ //-x
+ o.normal = float3(1, 0, 0);
+ if (dot(viewDirection, o.normal) < 0)
+ {
+ assembleVert(float3(cube.max.x, cube.max.y, cube.min.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.min.y, cube.max.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.min.y, cube.min.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ assembleVert(float3(cube.max.x, cube.min.y, cube.max.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.max.y, cube.min.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.max.y, cube.max.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ }
+
+ //+x
+ o.normal = float3(-1, 0, 0);
+ if (dot(viewDirection, o.normal) < 0)
+ {
+ assembleVert(float3(cube.min.x, cube.min.y, cube.min.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.min.y, cube.max.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.max.y, cube.min.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ assembleVert(float3(cube.min.x, cube.max.y, cube.max.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.max.y, cube.min.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.min.y, cube.max.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ }
+
+ //up
+ o.normal = float3(0, 1, 0);
+ if (dot(viewDirection, o.normal) < 0)
+ {
+ assembleVert(float3(cube.min.x, cube.max.y, cube.max.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.max.y, cube.min.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.max.y, cube.min.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ assembleVert(float3(cube.max.x, cube.max.y, cube.min.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.max.y, cube.max.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.max.y, cube.max.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ }
+
+ //down
+ o.normal = float3(0, -1, 0);
+ if (dot(viewDirection, o.normal) < 0)
+ {
+ assembleVert(float3(cube.min.x, cube.min.y, cube.min.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.min.y, cube.min.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.min.y, cube.max.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ assembleVert(float3(cube.max.x, cube.min.y, cube.max.z), IN[0], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.min.x, cube.min.y, cube.max.z), IN[1], uv, _TriToCube, o);
+ tristream.Append(o);
+ assembleVert(float3(cube.max.x, cube.min.y, cube.min.z), IN[2], uv, _TriToCube, o);
+ tristream.Append(o);
+ tristream.RestartStrip();
+ }
+ /*
+ for (int i = 0; i < 3; i ++)
+ {
+ IN[i].uv = uv;
+ tristream.Append(IN[i]);
+ }
+ */
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiGeom.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiGeom.cginc.meta
new file mode 100644
index 00000000..c5e1e965
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiGeom.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 0110416f419d6c1428eff564e8bba8a8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiHelpers.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiHelpers.cginc
new file mode 100644
index 00000000..a5ad08db
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiHelpers.cginc
@@ -0,0 +1,42 @@
+// Normals
+float3 CreateBinormal(float3 normal, float3 tangent, float binormalSign)
+{
+ return cross(normal, tangent.xyz) *
+ (binormalSign * unity_WorldTransformParams.w);
+}
+
+bool IsInMirror()
+{
+ return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f;
+}
+
+// Camera
+float3 getCameraPosition()
+{
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+}
+
+float3 getCameraForward()
+{
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1));
+ #endif
+ return normalize(p2 - p1);
+}
+
+float3 grayscale_vector_node()
+{
+ return float3(0, 0.3823529, 0.01845836);
+}
+
+float3 grayscale_for_light()
+{
+ return float3(0.298912, 0.586611, 0.114478);
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiHelpers.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiHelpers.cginc.meta
new file mode 100644
index 00000000..913b16d6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiHelpers.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 4046024b56935044b9bb885280ad296d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiLighting.cginc
new file mode 100644
index 00000000..be9c72f1
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiLighting.cginc
@@ -0,0 +1,124 @@
+#ifndef LIGHTING
+ #define LIGHTING
+
+ int _LightingType;
+ sampler2D _ToonRamp;
+ float _AdditiveSoftness;
+ float _AdditiveOffset;
+ float _ForceLightDirection;
+ float _ShadowStrength;
+ float _OutlineShadowStrength;
+ float _ShadowOffset;
+ float3 _LightDirection;
+ float _ForceShadowStrength;
+ float _CastedShadowSmoothing;
+ float _MinBrightness;
+ float _MaxBrightness;
+ float _IndirectContribution;
+ float _AttenuationMultiplier;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_AOMap); float4 _AOMap_ST;
+ float _AOStrength;
+
+ float3 ShadeSH9Indirect()
+ {
+ return ShadeSH9(half4(0.0, -1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Direct()
+ {
+ return ShadeSH9(half4(0.0, 1.0, 0.0, 1.0));
+ }
+
+ float3 ShadeSH9Normal(float3 normalDirection)
+ {
+ return ShadeSH9(half4(normalDirection, 1.0));
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ x1.b = length(unity_SHBb);
+ return x + x1;
+ }
+
+ float FadeShadows(float attenuation, float3 worldPosition)
+ {
+ float viewZ = dot(_WorldSpaceCameraPos - worldPosition, UNITY_MATRIX_V[2].xyz);
+ float shadowFadeDistance = UnityComputeShadowFadeDistance(worldPosition, viewZ);
+ float shadowFade = UnityComputeShadowFade(shadowFadeDistance);
+ attenuation = saturate(attenuation + shadowFade);
+ return attenuation;
+ }
+
+ float calculateAOMap(float AOMap, float AOStrength)
+ {
+ return lerp(1, AOMap, AOStrength);
+ }
+
+ void calculateBasePassLighting(float3 normal, float2 uv)
+ {
+ poiLight.direction = _WorldSpaceLightPos0;
+ poiLight.nDotL = dot(normal, poiLight.direction);
+ float AOMap = 1;
+ #ifndef OUTLINE
+ AOMap = UNITY_SAMPLE_TEX2D_SAMPLER(_AOMap, _MainTex, TRANSFORM_TEX(uv, _AOMap));
+ AOMap = calculateAOMap(AOMap, _AOStrength);
+ #endif
+
+ float3 grayscale_vector = grayscale_for_light();
+ float3 ShadeSH9Plus = GetSHLength();
+ float3 ShadeSH9Minus = ShadeSH9(float4(0, 0, 0, 1));
+ poiLight.directLighting = ShadeSH9Plus + poiLight.color;
+ poiLight.indirectLighting = ShadeSH9Minus;
+
+ float bw_lightColor = dot(poiLight.color, grayscale_vector);
+ float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, _AttenuationMultiplier)) + dot(ShadeSH9Normal(normal), grayscale_vector));
+ float bw_bottomIndirectLighting = dot(ShadeSH9Minus, grayscale_vector);
+ float bw_topIndirectLighting = dot(ShadeSH9Plus, grayscale_vector);
+ float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting);
+ poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting);
+ poiLight.rampedLightMap = tex2D(_ToonRamp, poiLight.lightMap + _ShadowOffset);
+
+ if (_LightingType == 0)
+ {
+ poiLight.finalLighting = lerp(saturate(poiLight.indirectLighting), lerp(poiLight.directLighting, poiLight.indirectLighting, _IndirectContribution), lerp(1, poiLight.rampedLightMap, _ShadowStrength)) * AOMap;
+ }
+ else
+ {
+ poiLight.finalLighting = saturate(poiLight.directLighting) * lerp(1, poiLight.rampedLightMap, _ShadowStrength) * AOMap;
+ }
+
+ poiLight.finalLighting = clamp(poiLight.finalLighting, _MinBrightness, _MaxBrightness);
+ }
+
+ void calculateLighting(v2f i)
+ {
+ #ifdef OUTLINE
+ _ShadowStrength = _OutlineShadowStrength;
+ #endif
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz)
+ poiLight.attenuation = FadeShadows(attenuation, i.worldPos.xyz);
+ poiLight.color = _LightColor0.rgb;
+ #ifdef FORWARD_BASE_PASS
+ calculateBasePassLighting(i.normal, i.uv);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.position = _WorldSpaceLightPos0.xyz;
+ poiLight.direction = normalize(poiLight.position - i.worldPos);
+ poiLight.nDotL = dot(i.normal, poiLight.direction);
+ poiLight.finalLighting = poiLight.color * poiLight.attenuation * smoothstep(.5 - _AdditiveSoftness + _AdditiveOffset, .5 + _AdditiveSoftness + _AdditiveOffset, .5 * poiLight.nDotL + .5);
+ #endif
+ #endif
+ }
+
+ void applyLighting(inout float4 finalColor)
+ {
+ finalColor.rgb *= poiLight.finalLighting;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiLighting.cginc.meta
new file mode 100644
index 00000000..9d5b777f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiLighting.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2c84013c28d21ab44a17e487e5202242
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMacros.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMacros.cginc
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMacros.cginc
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMacros.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMacros.cginc.meta
new file mode 100644
index 00000000..a9954ea2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMacros.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ad8c37b1d1291e44da5c6ec1a305cd8c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMatcap.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMatcap.cginc
new file mode 100644
index 00000000..4ed825f9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMatcap.cginc
@@ -0,0 +1,36 @@
+#ifndef MATCAP
+ #define MATCAP
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap);
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_MatcapMap); float4 _MatcapMap_ST;
+ float4 _MatcapColor;
+ float _MatcapStrength;
+ float _ReplaceWithMatcap;
+ float _MultiplyMatcap;
+ float _AddMatcap;
+
+ float3 matcap;
+ float matcapMask;
+
+ float2 getMatcapUV(float3 viewDirection, float3 normalDirection)
+ {
+ half3 worldViewUp = normalize(half3(0, 1, 0) - viewDirection * dot(viewDirection, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(viewDirection, worldViewUp));
+ half2 matcapUV = half2(dot(worldViewRight, normalDirection), dot(worldViewUp, normalDirection)) * 0.5 + 0.5;
+ return matcapUV;
+ }
+
+ void calculateMatcap(float3 cameraToVert, float3 normal, float2 uv)
+ {
+ float2 matcapUV = getMatcapUV(cameraToVert, normal);
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, matcapUV) * _MatcapColor * _MatcapStrength;
+ matcapMask = UNITY_SAMPLE_TEX2D_SAMPLER(_MatcapMap, _MainTex, TRANSFORM_TEX(uv, _MatcapMap));
+ }
+
+ void applyMatcap(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor, matcap, _ReplaceWithMatcap * matcapMask);
+ finalColor.rgb *= lerp(1, matcap, _MultiplyMatcap * matcapMask);
+ finalColor.rgb += matcap * _AddMatcap * matcapMask;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMatcap.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMatcap.cginc.meta
new file mode 100644
index 00000000..d9411dbf
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMatcap.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9e7eb4a81e5a57243b485f097c939493
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMetal.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMetal.cginc
new file mode 100644
index 00000000..43d84dc7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMetal.cginc
@@ -0,0 +1,77 @@
+#ifndef METAL
+ #define METAL
+
+ samplerCUBE _CubeMap;
+ float _SampleWorld;
+ float _PurelyAdditive;
+ sampler2D _MetallicMap; float4 _MetallicMap_ST;
+ float _Metallic;
+ sampler2D _SmoothnessMap; float4 _SmoothnessMap_ST;
+ float _InvertSmoothness;
+ float _Smoothness;
+
+ float3 finalreflections;
+ float metalicMap;
+ float3 reflection;
+ float roughness;
+ float lighty_boy_uwu_var;
+
+ void calculateReflections(float2 uv, float3 normal, float3 cameraToVert)
+ {
+ metalicMap = tex2D(_MetallicMap, TRANSFORM_TEX(uv, _MetallicMap)) * _Metallic;
+ float _Smoothness_map_var = (tex2D(_SmoothnessMap, TRANSFORM_TEX(uv, _SmoothnessMap)));
+ if (_InvertSmoothness == 1)
+ {
+ _Smoothness_map_var = 1 - _Smoothness_map_var;
+ }
+ _Smoothness_map_var *= _Smoothness;
+ roughness = 1 - _Smoothness_map_var;
+ roughness *= 1.7 - 0.7 * roughness;
+ float3 reflectedDir = reflect(-cameraToVert, normal);
+
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ //Probe 1
+ float4 reflectionData0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 reflectionColor0 = DecodeHDR(reflectionData0, unity_SpecCube0_HDR);
+
+ //Probe 2
+ float4 reflectionData1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 reflectionColor1 = DecodeHDR(reflectionData1, unity_SpecCube1_HDR);
+
+ reflection = lerp(reflectionColor1, reflectionColor0, interpolator);
+ }
+ else
+ {
+ float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ reflection = DecodeHDR(reflectionData, unity_SpecCube0_HDR);
+ }
+
+ bool no_probe = unity_SpecCube0_HDR.a == 0 && envSample.a == 0;
+ lighty_boy_uwu_var = 0;
+ if (no_probe || _SampleWorld)
+ {
+ lighty_boy_uwu_var = 1;
+ reflection = texCUBElod(_CubeMap, float4(reflectedDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ }
+ }
+
+ void applyReflections(inout float4 finalColor, float4 finalColorBeforeLighting)
+ {
+ #ifdef FORWARD_BASE_PASS
+ finalreflections = reflection.rgb * lerp(finalColorBeforeLighting.rgb, 1, _PurelyAdditive);
+ finalColor.rgb = finalColor.rgb * (1 - metalicMap);
+ finalColor.rgb += (finalreflections * ((1 - roughness + metalicMap) / 2)) * lerp(1, poiLight.finalLighting, lighty_boy_uwu_var);
+ #endif
+ }
+
+ void applyAdditiveReflectiveLighting(inout float4 finalColor)
+ {
+ finalColor *= (1 - metalicMap);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMetal.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMetal.cginc.meta
new file mode 100644
index 00000000..36c6e192
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiMetal.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7c691dfa699477f4190c7b70403a3f36
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineFrag.cginc
new file mode 100644
index 00000000..52cba137
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineFrag.cginc
@@ -0,0 +1,26 @@
+ float4 frag(v2f i, float facing: VFACE): COLOR
+ {
+ float alphaMultiplier = smoothstep(_OutlineFadeDistance.x, _OutlineFadeDistance.y, distance(getCameraPosition(), i.worldPos));
+ clip(_LineWidth - 0.001);
+ float _alphaMask_tex_var = tex2D(_AlphaMask, TRANSFORM_TEX(i.uv, _AlphaMask));
+ fixed4 _main_tex_var = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex));
+ fixed4 col = tex2D(_OutlineTexture, TRANSFORM_TEX((i.uv + (_OutlineTexturePan.xy * _Time.g)), _OutlineTexture));
+ col.a *= alphaMultiplier;
+
+ clip(col.a * _alphaMask_tex_var - _Clip);
+
+ col *= _LineColor;
+
+ #ifdef LIGHTING
+ calculateLighting(i);
+ #endif
+
+ float4 finalColor = col;
+
+ #ifdef LIGHTING
+ applyLighting(finalColor);
+ #endif
+
+ finalColor.rgb += (col.rgb * _OutlineEmission);
+ return finalColor;
+ } \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineFrag.cginc.meta
new file mode 100644
index 00000000..5ddf8ab9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineFrag.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3245036ffbf442745a7f0038571b9d7d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineIncludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineIncludes.cginc
new file mode 100644
index 00000000..2057bc8b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineIncludes.cginc
@@ -0,0 +1,46 @@
+
+#ifndef POICLUDES
+ #define POICLUDES
+
+ #include "PoiData.cginc"
+ #include "UnityCG.cginc"
+ #include "Lighting.cginc"
+ #include "UnityPBSLighting.cginc"
+ #include "AutoLight.cginc"
+
+ UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST;
+ float _LineWidth;
+ float _OutlineEmission;
+ float4 _LineColor;
+ float4 _Color;
+ float _Clip;
+ sampler2D _OutlineTexture; float4 _OutlineTexture_ST;
+ sampler2D _AlphaMask; float4 _AlphaMask_ST;
+ float4 _OutlineTexturePan;
+
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+
+ struct VertexInput
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float2 texcoord0: TEXCOORD0;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ float2 uv: TEXCOORD0;
+ float3 normal: TEXCOORD1;
+ float3 worldPos: TEXCOORD2;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ UNITY_SHADOW_COORDS(3)
+ UNITY_FOG_COORDS(4)
+ };
+
+ static PoiLighting poiLight;
+ float pi;
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineIncludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineIncludes.cginc.meta
new file mode 100644
index 00000000..b54d15c6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineIncludes.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8bc5e7c580bf74f4daf36e44f0bcc552
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineVert.cginc
new file mode 100644
index 00000000..d82223d2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineVert.cginc
@@ -0,0 +1,28 @@
+#ifndef OutlineVert
+ #define OutlineVert
+
+ v2f vert(VertexInput v)
+ {
+ v2f o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+
+ #ifdef FUN
+ applyFun(v.vertex);
+ #endif
+
+ o.uv = v.texcoord0 + _OutlineGlobalPan.xy * _Time.y;
+
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ float3 offset = o.normal * (_LineWidth/100);
+ o.worldPos = mul(unity_ObjectToWorld, v.vertex) + float4(offset,0);
+
+ o.pos = UnityWorldToClipPos(o.worldPos);
+
+ UNITY_TRANSFER_SHADOW(o, o.uv);
+ UNITY_TRANSFER_FOG(o, o.pos);
+ return o;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineVert.cginc.meta
new file mode 100644
index 00000000..8552b862
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiOutlineVert.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 31c5e772bdbeb7e438a6cb639b69815a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPanosphere.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPanosphere.cginc
new file mode 100644
index 00000000..d167c6a0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPanosphere.cginc
@@ -0,0 +1,41 @@
+#ifndef PANOSPHERE
+ #define PANOSPHERE
+
+ sampler2D _PanosphereTexture; float4 _PanosphereTexture_ST;
+ sampler2D _PanoMapTexture; float4 _PanoMapTexture_ST;
+ float _PanoEmission;
+ float _PanoBlend;
+ float4 _PanosphereColor;
+ float4 _PanosphereScroll;
+
+ float3 panoColor;
+ float panoMask;
+
+ float2 StereoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude + _Time.y * _PanosphereScroll.x, latitude + _Time.y * _PanosphereScroll.y) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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;
+ }
+
+ void calculatePanosphere(float3 worldPos, float2 uv)
+ {
+ float2 _StereoEnabled_var = StereoPanoProjection(normalize(_WorldSpaceCameraPos.xyz - worldPos.xyz) * - 1);
+ panoColor = tex2D(_PanosphereTexture, TRANSFORM_TEX(_StereoEnabled_var, _PanosphereTexture)) * _PanosphereColor.rgb;
+ panoMask = tex2D(_PanoMapTexture, TRANSFORM_TEX(uv, _PanoMapTexture));
+ }
+
+ void applyPanosphereColor(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor.rgb, panoColor, _PanoBlend * panoMask);
+ }
+
+ void applyPanosphereEmission(inout float4 finalColor)
+ {
+ finalColor.rgb += panoColor * _PanoBlend * panoMask * _PanoEmission;
+ }
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPanosphere.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPanosphere.cginc.meta
new file mode 100644
index 00000000..ff1c1083
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPanosphere.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: eaa1b35980202f640aba378002e247c0
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPass.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPass.cginc
new file mode 100644
index 00000000..fdcd589b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPass.cginc
@@ -0,0 +1,28 @@
+#ifndef POI_PASS
+ #define POI_PASS
+
+ #include "Poicludes.cginc"
+ #include "PoiHelpers.cginc"
+ #include "PoiBasics.cginc"
+ #include "PoiEmission.cginc"
+ #ifndef DRAG_N_DROP
+ #include "PoiLighting.cginc"
+ #include "PoiFun.cginc"
+ #ifndef GOTTA_GO_FAST
+ #include "PoiScrollingLayers.cginc"
+ #include "PoiTextureBlending.cginc"
+ #include "PoiPanosphere.cginc"
+ #include "PoiRimlighting.cginc"
+ #include "PoiMetal.cginc"
+ #include "PoiMatcap.cginc"
+ #include "PoiSpecular.cginc"
+ #include "PoiSubsurfaceScattering.cginc"
+ #endif
+ #else
+ #include "PoiDragNDropLighting.cginc"
+ #endif
+
+ #include "PoiVert.cginc"
+ #include "PoiFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPass.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPass.cginc.meta
new file mode 100644
index 00000000..20709994
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPass.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8e55c50551f60a043b5127d93c0a7906
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassOutline.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassOutline.cginc
new file mode 100644
index 00000000..b77839ff
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassOutline.cginc
@@ -0,0 +1,18 @@
+#ifndef POI_PASS_OUTLINE
+ #define POI_PASS_OUTLINE
+
+ #pragma target 5.0
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma multi_compile_instancing
+ #define FORWARD_BASE_PASS
+ #define OUTLINE
+ #include "PoiOutlineIncludes.cginc"
+ #include "PoiHelpers.cginc"
+ #include "PoiFun.cginc"
+ #include "PoiLighting.cginc"
+ #include "PoiOutlineVert.cginc"
+ #include "PoiOutlineFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassOutline.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassOutline.cginc.meta
new file mode 100644
index 00000000..a29147a7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassOutline.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: be0358aa48706344da098705a5795d9a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassShadow.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassShadow.cginc
new file mode 100644
index 00000000..42abd7ec
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassShadow.cginc
@@ -0,0 +1,14 @@
+#ifndef POI_PASS_SHADOW
+ #define POI_PASS_SHADOW
+
+ #pragma target 5.0
+ #pragma multi_compile_shadowcaster
+ #include "UnityCG.cginc"
+ #include "UnityShaderVariables.cginc"
+ #include "PoiShadowIncludes.cginc"
+ #include "PoiHelpers.cginc"
+ #include "PoiFun.cginc"
+ #include "PoiShadowVert.cginc"
+ #include "PoiShadowFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassShadow.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassShadow.cginc.meta
new file mode 100644
index 00000000..0d897a88
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiPassShadow.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a67f98d2ea6b4d64f82e39d30923f91e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRefraction.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRefraction.cginc
new file mode 100644
index 00000000..6da9a05a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRefraction.cginc
@@ -0,0 +1,49 @@
+#ifndef REFRACTION
+ #define REFRACTION
+
+ sampler2D _PoiGrab;
+ float _IndexOfRefraction;
+ float _RefractionOpacity;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RefractionOpacityMask); float4 _RefractionOpacityMask_ST;
+
+ float3 refraction;
+ float refractionOpacityMask;
+
+ inline float4 Refraction(v2f i, float indexOfRefraction/*, float chomaticAberration*/)
+ {
+ float4 screenPos = i.screenPos;
+ #if UNITY_UV_STARTS_AT_TOP
+ float scale = -1.0;
+ #else
+ float scale = 1.0;
+ #endif
+ float halfPosW = screenPos.w * 0.5;
+ screenPos.y = (screenPos.y - halfPosW) * _ProjectionParams.x * scale + halfPosW;
+ #if SHADER_API_D3D9 || SHADER_API_D3D11
+ screenPos.w += 0.00000000001;
+ #endif
+ float2 projScreenPos = (screenPos / screenPos.w).xy;
+ float3 worldViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos));
+ float3 refractionOffset = ((((indexOfRefraction - 1.0) * mul(UNITY_MATRIX_V, float4(i.normal, 0.0))) * (1.0 / (screenPos.z + 1.0))) * (1.0 - dot(i.normal, worldViewDir)));
+ float2 cameraRefraction = float2(refractionOffset.x, - (refractionOffset.y * _ProjectionParams.x));
+ return tex2D(_PoiGrab, (projScreenPos + cameraRefraction));
+ /*
+ float4 redAlpha = tex2D(_GrabTexture, (projScreenPos + cameraRefraction));
+ float green = tex2D(_GrabTexture, (projScreenPos + (cameraRefraction * (1.0 - chomaticAberration)))).g;
+ float blue = tex2D(_GrabTexture, (projScreenPos + (cameraRefraction * (1.0 + chomaticAberration)))).b;
+ return float4(redAlpha.r, green, blue, redAlpha.a);
+ */
+ }
+
+ void calculateRefraction(v2f i)
+ {
+ refraction = Refraction(i, _IndexOfRefraction).rgb;
+ refractionOpacityMask = UNITY_SAMPLE_TEX2D_SAMPLER(_RefractionOpacityMask, _MainTex, TRANSFORM_TEX(i.uv, _RefractionOpacityMask));
+ }
+
+ void applyRefraction(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(refraction, finalColor, _RefractionOpacity * refractionOpacityMask);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRefraction.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRefraction.cginc.meta
new file mode 100644
index 00000000..dd3363d0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRefraction.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3b42a5209d7a47440a5f7466b1dac531
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRimLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRimLighting.cginc
new file mode 100644
index 00000000..f5cacba3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRimLighting.cginc
@@ -0,0 +1,39 @@
+#ifndef RIM_LIGHTING
+ #define RIM_LIGHTING
+
+ float4 _RimLightColor;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimLightColorBias;
+ float4 _RimTexPanSpeed;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RimTex); float4 _RimTex_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RimMask); float4 _RimMask_ST;
+
+ float4 rimColor = float4(0, 0, 0, 0);
+ float rim = 0;
+
+ void calculateRimLighting(float2 uv, float cameraDotVert)
+ {
+ float rimMask = UNITY_SAMPLE_TEX2D_SAMPLER(_RimMask, _MainTex, TRANSFORM_TEX(uv, _RimMask));
+ rimColor = UNITY_SAMPLE_TEX2D_SAMPLER(_RimTex, _MainTex, TRANSFORM_TEX(uv, _RimTex) + (_Time.y * _RimTexPanSpeed.xy)) * _RimLightColor;
+ _RimWidth = lerp(_RimWidth,_RimWidth * lerp(0,1,poiLight.lightMap-_ShadowMixThreshold) * _ShadowMixWidthMod,_ShadowMix);
+ rim = 1-smoothstep(min(_RimSharpness,_RimWidth),_RimWidth,cameraDotVert);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+ }
+
+ void applyRimColor(inout float4 finalColor)
+ {
+ finalColor.rgb = lerp(finalColor.rgb, lerp(finalColor.rgb, rimColor, _RimLightColorBias), rim);
+ }
+
+ void ApplyRimEmission(inout float4 finalColor)
+ {
+ finalColor.rgb += rim * rimColor * _RimStrength;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRimLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRimLighting.cginc.meta
new file mode 100644
index 00000000..02866e40
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiRimLighting.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8cc181529cb7e164eb0bc84365fc12a4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiScrollingLayers.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiScrollingLayers.cginc
new file mode 100644
index 00000000..cc27ff88
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiScrollingLayers.cginc
@@ -0,0 +1,23 @@
+#ifndef SCROLLING_LAYERS
+ #define SCROLLING_LAYERS
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_LayerTexture); float4 _LayerTexture_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_LayerMask); float4 _LayerMask_ST;
+ float4 _LayerColor;
+ float4 _LayerSpeed;
+ float _Layers;
+ float _LayerShrinkage;
+
+ float4 color;
+ float4 calculateScrollingLayers(float2 uv)
+ {
+ color = 0;
+
+ for (int i = 0; i < _Layers; i++) {
+ float2 uvMod = (1 + i*_LayerShrinkage) + (_Time.y * _LayerSpeed.xy);// / (1+i/3);
+ color = saturate(color + UNITY_SAMPLE_TEX2D_SAMPLER(_LayerTexture, _MainTex, TRANSFORM_TEX(uv, _LayerTexture) * uvMod )) / (1+i*2);
+ }
+
+ return color * _LayerColor;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiScrollingLayers.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiScrollingLayers.cginc.meta
new file mode 100644
index 00000000..2e31cfb7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiScrollingLayers.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 04d6f9981ab9b9a489db5cb7bedbe941
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowFrag.cginc
new file mode 100644
index 00000000..02331e51
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowFrag.cginc
@@ -0,0 +1,29 @@
+#ifndef SHADOW_FRAG
+ #define SHADOW_FRAG
+
+ half4 fragShadowCaster(
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ VertexOutputShadowCaster i
+ #endif
+ ): SV_Target
+ {
+ #ifdef FUN
+ applyFunFrag();
+ #endif
+
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ half alpha = tex2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex)).a * _Color.a;
+ half alphaMask = tex2D(_AlphaMask, TRANSFORM_TEX(i.uv, _AlphaMask));
+
+ #ifdef CUTOUT
+ clip(alpha * alphaMask - _Clip);
+ #endif
+ #ifdef TRANSPARENT
+ clip(alpha * alphaMask - 0.01);
+ #endif
+ #endif
+
+ SHADOW_CASTER_FRAGMENT(i)
+ }
+
+ #endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowFrag.cginc.meta
new file mode 100644
index 00000000..8613fdcb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowFrag.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e264d11d61c3f6b4da7cf7ca0afeb2b8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowIncludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowIncludes.cginc
new file mode 100644
index 00000000..0bdf8e2e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowIncludes.cginc
@@ -0,0 +1,29 @@
+#ifndef SHADOW_INCLUDES
+ #define SHADOW_INCLUDES
+
+ #define UNITY_STANDARD_USE_SHADOW_UVS 1
+
+ float4 _Color;
+ float _Clip;
+ sampler2D _MainTex; float4 _MainTex_ST;
+ float4 _GlobalPanSpeed;
+ sampler2D _AlphaMask; float4 _AlphaMask_ST;
+
+ struct VertexInput
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float2 uv0: TEXCOORD0;
+ };
+
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ struct VertexOutputShadowCaster
+ {
+ V2F_SHADOW_CASTER_NOPOS
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ float2 uv: TEXCOORD1;
+ #endif
+ };
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowIncludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowIncludes.cginc.meta
new file mode 100644
index 00000000..159bff8a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowIncludes.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1e46f338a3c4bac43b616326ad55efae
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowVert.cginc
new file mode 100644
index 00000000..a855047b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowVert.cginc
@@ -0,0 +1,11 @@
+void vertShadowCaster(VertexInput v,
+#if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ out VertexOutputShadowCaster o,
+#endif
+out float4 opos: SV_POSITION)
+{
+ TRANSFER_SHADOW_CASTER_NOPOS(o, opos)
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ o.uv = TRANSFORM_TEX(v.uv0 + _GlobalPanSpeed.xy * float2(_Time.y, _Time.y), _MainTex);
+ #endif
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowVert.cginc.meta
new file mode 100644
index 00000000..fb104209
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiShadowVert.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b779a0b47859b5444b0a513ac6ee601c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSpecular.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSpecular.cginc
new file mode 100644
index 00000000..058bcb7c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSpecular.cginc
@@ -0,0 +1,173 @@
+#ifndef SPECULAR
+ #define SPECULAR
+
+ int _SpecularType;
+ int _SmoothnessFrom;
+ int _SpecularColorFrom;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_SpecularMap); float4 _SpecularMap_ST;
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_SpecularHighTexture); float4 _SpecularHighTexture_ST;
+ float4 _SpecularTint;
+ float _SpecularSmoothness;
+
+ // Globals
+ half4 finalSpecular;
+ half4 highTexture;
+
+ UnityIndirect ZeroIndirect()
+ {
+ UnityIndirect ind;
+ ind.diffuse = 0;
+ ind.specular = 0;
+ return ind;
+ }
+
+ // From unity just putting it here in case I want to mod it
+ half4 poiRealisticSpecular(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness,
+ float3 normal, float3 viewDir,
+ UnityLight light, UnityIndirect gi)
+ {
+ float perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness);
+ float3 halfDir = Unity_SafeNormalize(float3(light.dir) + viewDir);
+
+ // NdotV should not be negative for visible pixels, but it can happen due to perspective projection and normal mapping
+ // In this case normal should be modified to become valid (i.e facing camera) and not cause weird artifacts.
+ // but this operation adds few ALU and users may not want it. Alternative is to simply take the abs of NdotV (less correct but works too).
+ // Following define allow to control this. Set it to 0 if ALU is critical on your platform.
+ // This correction is interesting for GGX with SmithJoint visibility function because artifacts are more visible in this case due to highlight edge of rough surface
+ // Edit: Disable this code by default for now as it is not compatible with two sided lighting used in SpeedTree.
+ #define UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV 0
+
+ #if UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV
+ // The amount we shift the normal toward the view vector is defined by the dot product.
+ half shiftAmount = dot(normal, viewDir);
+ normal = shiftAmount < 0.0f ? normal + viewDir * (-shiftAmount + 1e-5f): normal;
+ // A re-normalization should be applied here but as the shift is small we don't do it to save ALU.
+ //normal = normalize(normal);
+
+ float nv = saturate(dot(normal, viewDir)); // TODO: this saturate should no be necessary here
+ #else
+ half nv = abs(dot(normal, viewDir)); // This abs allow to limit artifact
+ #endif
+
+ float nl = saturate(dot(normal, light.dir));
+ float nh = saturate(dot(normal, halfDir));
+
+ half lv = saturate(dot(light.dir, viewDir));
+ half lh = saturate(dot(light.dir, halfDir));
+
+ // Diffuse term
+ half diffuseTerm = DisneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;
+
+ // Specular term
+ // HACK: theoretically we should divide diffuseTerm by Pi and not multiply specularTerm!
+ // BUT 1) that will make shader look significantly darker than Legacy ones
+ // and 2) on engine side "Non-important" lights have to be divided by Pi too in cases when they are injected into ambient SH
+ float roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
+
+ // GGX with roughtness to 0 would mean no specular at all, using max(roughness, 0.002) here to match HDrenderloop roughtness remapping.
+ roughness = max(roughness, 0.002);
+ float V = SmithJointGGXVisibilityTerm(nl, nv, roughness);
+ float D = GGXTerm(nh, roughness);
+
+ float specularTerm = V * D * UNITY_PI; // Torrance-Sparrow model, Fresnel is applied later
+
+ #ifdef UNITY_COLORSPACE_GAMMA
+ specularTerm = sqrt(max(1e-4h, specularTerm));
+ #endif
+
+ // specularTerm * nl can be NaN on Metal in some cases, use max() to make sure it's a sane value
+ specularTerm = max(0, specularTerm * nl);
+ #if defined(_SPECULARHIGHLIGHTS_OFF)
+ specularTerm = 0.0;
+ #endif
+
+ // surfaceReduction = Int D(NdotH) * NdotH * Id(NdotL>0) dH = 1/(roughness^2+1)
+ half surfaceReduction;
+ #ifdef UNITY_COLORSPACE_GAMMA
+ surfaceReduction = 1.0 - 0.28 * roughness * perceptualRoughness; // 1-0.28*x^3 as approximation for (1/(x^4+1))^(1/2.2) on the domain [0;1]
+ #else
+ surfaceReduction = 1.0 / (roughness * roughness + 1.0); // fade \in [0.5;1]
+ #endif
+
+ // To provide true Lambert lighting, we need to be able to kill specular completely.
+ specularTerm *= any(specColor) ? 1.0: 0.0;
+
+ half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity));
+ half3 color = diffColor * (gi.diffuse + light.color * diffuseTerm)
+ + specularTerm * light.color * FresnelTerm(specColor, lh)
+ + surfaceReduction * gi.specular * FresnelLerp(specColor, grazingTerm, nv);
+
+ return half4(color, 1);
+ }
+
+ void calculateRealisticSpecular(float3 normal, float4 albedo, float3 viewDir, float2 uv)
+ {
+ half4 spec = UNITY_SAMPLE_TEX2D_SAMPLER(_SpecularMap, _MainTex, TRANSFORM_TEX(uv, _SpecularMap));
+
+ half oneMinusReflectivity;
+
+ UnityLight unityLight;
+ unityLight.color = poiLight.color;
+ unityLight.dir = poiLight.direction;
+ unityLight.ndotl = poiLight.nDotL;
+
+ UNITY_BRANCH
+ if(_SmoothnessFrom == 0)
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, spec.rgb * _SpecularTint.rgb, /*out*/ oneMinusReflectivity);
+ finalSpecular = poiRealisticSpecular(diffColor, spec.rgb, oneMinusReflectivity, spec.a * _SpecularSmoothness, normal, viewDir, unityLight, ZeroIndirect());
+ }
+ else
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, _SpecularTint.rgb, /*out*/ oneMinusReflectivity);
+ float smoothness = max (max (spec.r, spec.g), spec.b);
+ finalSpecular = poiRealisticSpecular(diffColor, 1, oneMinusReflectivity, smoothness * _SpecularSmoothness, normal, viewDir, unityLight, ZeroIndirect());
+ }
+ }
+
+ void calculateToonSpecular(float3 normal, float4 albedo, float3 viewDir, float2 uv)
+ {
+ finalSpecular = 1;
+ calculateRealisticSpecular(normal, albedo, viewDir, uv);
+ float specIntensity = dot(finalSpecular.rgb, grayscale_for_light());
+ finalSpecular.rgb = smoothstep(0.99,1, specIntensity) * poiLight.color.rgb * poiLight.attenuation;
+ }
+
+ void calculateSpecular(float3 normal, float4 albedo, float3 viewDir, float2 uv)
+ {
+ highTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_SpecularHighTexture, _MainTex, TRANSFORM_TEX(uv, _SpecularHighTexture));
+
+ UNITY_BRANCH
+ if (_SpecularType == 0) // Off
+ {
+ return;
+ }
+ else if (_SpecularType == 1) // Realistic
+ {
+ calculateRealisticSpecular(normal, albedo, viewDir, uv);
+ finalSpecular *= poiLight.attenuation;
+ }
+ else if (_SpecularType == 2) // Toon
+ {
+ calculateToonSpecular(normal, albedo, viewDir, uv);
+ }
+ else if (_SpecularType == 4) // anisotropic
+ {
+ return;
+ }
+ }
+
+ void applySpecular(inout float4 finalColor)
+ {
+ if(_SpecularColorFrom == 0)
+ {
+ finalColor.rgb += finalSpecular.rgb * _SpecularTint.rgb;
+ }
+ else
+ {
+ float specIntensity = max (max (finalSpecular.r, finalSpecular.g), finalSpecular.b);
+ finalColor.rgb += lerp(0, highTexture.rgb, saturate(specIntensity)) * _SpecularTint.rgb;
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSpecular.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSpecular.cginc.meta
new file mode 100644
index 00000000..f3eddf8a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSpecular.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7d524a9f958280e4ca1b5f64f8b1e50b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSubsurfaceScattering.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSubsurfaceScattering.cginc
new file mode 100644
index 00000000..58cf74a0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSubsurfaceScattering.cginc
@@ -0,0 +1,30 @@
+#ifndef SUBSURFACE
+ #define SUBSURFACE
+
+ float _SSSThicknessMod;
+ float _SSSStrength;
+ float _SSSPower;
+ float _SSSDistortion;
+ float4 _SSSColor;
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_SSSThicknessMap); float4 _SSSThicknessMap_ST;
+
+ float3 finalSSS;
+
+ void calculateSubsurfaceScattering(v2f i, float3 viewDir)
+ {
+ float SSS = 1 - UNITY_SAMPLE_TEX2D_SAMPLER(_SSSThicknessMap, _MainTex, TRANSFORM_TEX(i.uv, _SSSThicknessMap));
+
+ half3 vLTLight = poiLight.direction + baseNormal * _SSSDistortion;
+ half flTDot = pow(saturate(dot(viewDir, -vLTLight)), _SSSPower) * _SSSStrength;
+ half3 fLT = poiLight.attenuation * (flTDot) * saturate(SSS + -1 * _SSSThicknessMod);
+
+ finalSSS = fLT;
+ }
+
+ void applySubsurfaceScattering(inout float4 finalColor)
+ {
+ finalColor.rgb += finalSSS * poiLight.color * albedo * _SSSColor;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSubsurfaceScattering.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSubsurfaceScattering.cginc.meta
new file mode 100644
index 00000000..2910fa3c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiSubsurfaceScattering.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 652e127dbbf09f8439c062ffcfd431b4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiTextureBlending.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiTextureBlending.cginc
new file mode 100644
index 00000000..cf9d199a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiTextureBlending.cginc
@@ -0,0 +1,33 @@
+#ifndef TEXTURE_BLENDING
+ #define TEXTURE_BLENDING
+
+ int _Blend;
+ float4 _BlendTextureColor;
+ sampler2D _BlendTexture; float4 _BlendTexture_ST;
+ sampler2D _BlendNoiseTexture; float4 _BlendNoiseTexture_ST;
+ float _BlendAlpha;
+ float _BlendTiling;
+ float _AutoBlend;
+ float _AutoBlendSpeed;
+ float _AutoBlendDelay;
+
+ float blendAlpha = 0;
+
+ void calculateTextureBlending(float blendAlpha, inout float4 mainTexture, inout float4 diffuse, float2 uv)
+ {
+ UNITY_BRANCH
+ if (_Blend != 0)
+ {
+ float blendNoise = tex2D(_BlendNoiseTexture, TRANSFORM_TEX(uv, _BlendNoiseTexture));
+ if(_AutoBlend > 0)
+ {
+ blendAlpha = (clamp(sin(_Time.y * _AutoBlendSpeed / _AutoBlendDelay) * (_AutoBlendDelay + 1), -1, 1) + 1) / 2;
+ }
+ blendAlpha = lerp(saturate((blendNoise - 1) + blendAlpha * 2), step(blendAlpha * 1.001, blendNoise), _Blend - 1);
+
+ float4 blendCol = tex2D(_BlendTexture, TRANSFORM_TEX(uv, _BlendTexture)) * _BlendTextureColor;
+ diffuse = lerp(diffuse, blendCol, blendAlpha);
+ mainTexture.a = lerp(mainTexture.a, blendCol.a, blendAlpha);
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiTextureBlending.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiTextureBlending.cginc.meta
new file mode 100644
index 00000000..a0f15399
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiTextureBlending.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d23c5fcad4c581c47ad9c14ea07c3ab1
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiVert.cginc
new file mode 100644
index 00000000..6fe6dde6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiVert.cginc
@@ -0,0 +1,32 @@
+#ifndef POIVERT
+ #define POIVERT
+ v2f vert(appdata v)
+ {
+ v2f o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+
+ #ifdef FUN
+ applyFun(v.vertex);
+ #endif
+
+ TANGENT_SPACE_ROTATION;
+ o.localPos = v.vertex;
+ o.pos = UnityObjectToClipPos(o.localPos);
+ //o.screenPos = ComputeScreenPos(o.pos);
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ o.uv = v.texcoord.xy + _GlobalPanSpeed.xy * _Time.y;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ #if defined(BINORMAL_PER_FRAGMENT)
+ o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
+ #else
+ o.tangent = UnityObjectToWorldDir(v.tangent.xyz);
+ o.binormal = CreateBinormal(o.normal, o.tangent, v.tangent.w);
+ #endif
+ UNITY_TRANSFER_SHADOW(o, o.uv);
+ UNITY_TRANSFER_FOG(o, o.pos);
+ o.vertexId = v.vertexId;
+ return o;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiVert.cginc.meta
new file mode 100644
index 00000000..3e338521
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/PoiVert.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ff346a2a2e9500945a02a9c50e8feccf
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/Poicludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/Poicludes.cginc
new file mode 100644
index 00000000..0dfa5e24
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/Poicludes.cginc
@@ -0,0 +1,46 @@
+#ifndef POICLUDES
+ #define POICLUDES
+
+ #include "PoiData.cginc"
+ #include "UnityCG.cginc"
+ #include "Lighting.cginc"
+ #include "UnityPBSLighting.cginc"
+ #include "AutoLight.cginc"
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float2 texcoord: TEXCOORD0;
+ float2 texcoord1: TEXCOORD1;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float2 uv: TEXCOORD0;
+ float3 normal: TEXCOORD1;
+ #if defined(BINORMAL_PER_FRAGMENT)
+ float4 tangent: TEXCOORD2;
+ #else
+ float3 tangent: TEXCOORD2;
+ float3 binormal: TEXCOORD3;
+ #endif
+ float4 pos: SV_POSITION;
+ float4 worldPos: TEXCOORD4;
+ float4 localPos: TEXCOORD5;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ UNITY_SHADOW_COORDS(7)
+ UNITY_FOG_COORDS(8)
+ uint vertexId: TEXCOORD9;
+ };
+
+ static PoiLighting poiLight;
+ float3 baseNormal;
+ #define pi float(3.14159265359)
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/Poicludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/Poicludes.cginc.meta
new file mode 100644
index 00000000..4c6f3622
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Includes/Poicludes.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1477de18f5f465643b94da7909775248
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader.meta
new file mode 100644
index 00000000..3e9aa553
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 69844908da5c4324d91145e259b408d3
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/Cubed.mat b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/Cubed.mat
new file mode 100644
index 00000000..0eac8493
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/Cubed.mat
@@ -0,0 +1,831 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: Cubed
+ m_Shader: {fileID: 4800000, guid: cd0442380db86bb4783e70d0dd6a7e96, type: 3}
+ m_ShaderKeywords: _NORMALMAP
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap: {}
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _AOMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _AdditiveRamp:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _AlphaMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _AnisoTangentMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BackTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BlendNoiseTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BlendTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BulgeMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ClearCoatCubeMap:
+ m_Texture: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ClearCoatMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ClearCoatSmoothnessMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _CubeMap:
+ m_Texture: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DissolveDetailNoise:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DissolveEdgeGradient:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DissolveMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DissolveNoiseTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DissolveToTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _FlipbookTexArray:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _FlipbookTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _FrontTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _FurHeightMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _FurMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _FurTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _GradientBack:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _GradientFront:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _HighlightMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _LightingShadowMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _LineworkMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainFadeTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Matcap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Matcap2:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Matcap2Mask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MatcapMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MatcapMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MirrorTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NameTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NoiseBack:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NoiseFront:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NoiseTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _PanoCubeMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _PanoMapTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _PanosphereTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxHeightMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxInternalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParticleFlipbookTexArray:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParticleMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParticleStartColorGradient:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParticleTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _Ramp:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RimEnviroMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RimMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RimTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RimWidthNoiseTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _RoughnessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SSSThicknessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SmoothnessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SmoothnessMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecularHighTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecularMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecularMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ToonRamp:
+ m_Texture: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _UnderWaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _WaveTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - DSGI: 0
+ - Instancing: 0
+ - LightmapFlags: 0
+ - _AOStrength: 1
+ - _AddMatcap: 0
+ - _AdditiveClearCoat: 0
+ - _AdditiveOffset: 0
+ - _AdditiveSoftness: 0.005
+ - _AngleCompareTo: 0
+ - _AngleMinAlpha: 0
+ - _AngleType: 0
+ - _AnisoSpec1Alpha: 1
+ - _AnisoSpec2Alpha: 1
+ - _AnisoUseTangentMap: 0
+ - _AoRampMax: 1
+ - _AoRampMin: 0
+ - _AssemblyMode: 0
+ - _AttenuationMultiplier: 0
+ - _AutoBlend: 0
+ - _AutoBlendDelay: 2
+ - _AutoBlendSpeed: 2
+ - _BackEmission: 0
+ - _BackGradientMod: 0
+ - _BackgroundEmission: 0
+ - _BackgroundGradientMax: 0.4
+ - _BackgroundGradientMin: 0.25
+ - _Blend: 0
+ - _BlendAlpha: 0
+ - _BlendBack: 1
+ - _BlendFront: 1
+ - _BuldgeFadeLength: 0.02
+ - _BuldgeHeight: 0.02
+ - _BumpMapUV: 0
+ - _BumpScale: 1
+ - _CameraAngleMax: 90
+ - _CameraAngleMin: 45
+ - _ClearCoat: 1
+ - _ClearCoatInvertSmoothness: 0
+ - _ClearCoatNormalToUse: 0
+ - _ClearCoatSampleWorld: 0
+ - _ClearCoatSmoothness: 0
+ - _Clip: 0.5
+ - _ColorOverLifeSpeed: 1
+ - _ColorOverLifetime: 0
+ - _ContinuousDissolve: 0
+ - _CubeGradientDebug: 0
+ - _Cull: 2
+ - _Cutoff: 0.5
+ - _DebugCameraData: 0
+ - _DebugDisplayDebug: 0
+ - _DebugLightingData: 0
+ - _DebugMeshData: 0
+ - _DebugSpecularData: 0
+ - _DepthGlowEmission: 3
+ - _Desaturation: 0
+ - _DestinationBlend: 10
+ - _DetailBrightness: 1
+ - _DetailNormalMapScale: 1
+ - _DetailNormalUV: 0
+ - _DetailTexIntensity: 1
+ - _DetailTexUV: 0
+ - _DissolveAlpha: 0
+ - _DissolveDetailStrength: 0.1
+ - _DissolveEdgeEmission: 0
+ - _DissolveEdgeHardness: 0.5
+ - _DissolveEdgeWidth: 0.025
+ - _DissolveInvertDetailNoise: 0
+ - _DissolveInvertNoise: 0
+ - _DissolveP2PEdgeLength: 0.1
+ - _DissolveP2PWorldLocal: 0
+ - _DissolveSideEmission: 0
+ - _DissolveSideFlipbook: 0
+ - _DissolveSideMatcap: 0
+ - _DissolveSideMetallic: 0
+ - _DissolveSidePanosphere: 0
+ - _DissolveSideRim: 0
+ - _DissolveSideSpecular: 0
+ - _DissolveSideSubsurface: 0
+ - _DissolveToEmissionStrength: 0
+ - _DissolveType: 0
+ - _DstBlend: 0
+ - _EmissionCenterOutEnabled: 0
+ - _EmissionCenterOutSpeed: 5
+ - _EmissionStrength: 0
+ - _EmissionUV: 0
+ - _EmissiveBlink_Max: 1
+ - _EmissiveBlink_Min: 1
+ - _EmissiveBlink_Velocity: 4
+ - _EmissiveScroll_Interval: 20
+ - _EmissiveScroll_Velocity: 10
+ - _EmissiveScroll_Width: 10
+ - _EnableClearCoat: 0
+ - _EnableDissolve: 0
+ - _EnableEmission: 0
+ - _EnableEnvironmentalRim: 0
+ - _EnableFlipbook: 0
+ - _EnableFun: 0
+ - _EnableGITDEmission: 0
+ - _EnableLighting: 1
+ - _EnableMatcap: 0
+ - _EnableMetallic: 0
+ - _EnableMirrorOptions: 0
+ - _EnableMirrorTexture: 0
+ - _EnableParticleFlipbook: 0
+ - _EnableRandom: 0
+ - _EnableRimLighting: 0
+ - _EnableSSS: 0
+ - _EnableSpecular: 0
+ - _ExplodeFadeDistance: 0.3
+ - _ExplodeMode: 0
+ - _FadeLength: 0.02
+ - _FlatOrFullAmbientLighting: 0
+ - _FlipbookAdd: 0
+ - _FlipbookColumns: 1
+ - _FlipbookCurrentFrame: -1
+ - _FlipbookEmissionStrength: 0
+ - _FlipbookFPS: 30
+ - _FlipbookMultiply: 0
+ - _FlipbookReplace: 0
+ - _FlipbookRotation: 0
+ - _FlipbookRows: 1
+ - _FlipbookTiled: 0
+ - _FlipbookTotalFrames: 1
+ - _FlipbookUV: 0
+ - _ForceLightDirection: 0
+ - _ForceOpaque: 1
+ - _ForceShadowStrength: 0
+ - _ForegroundGradientMax: 0.25
+ - _ForegroundGradientMin: 0.2
+ - _Fresnel: 5
+ - _FrontEmission: 0
+ - _FrontGradientMod: 0
+ - _FurAO: 0.5
+ - _FurDebug: 0
+ - _FurGravityStrength: 0
+ - _FurHeightMapMax: 1
+ - _FurHeightMapMin: 0
+ - _FurLayers: 20
+ - _FurLength: 0.025
+ - _FurMaxDistance: 10
+ - _FurMinDistance: 2
+ - _GIEmissionMultiplier: 1
+ - _GITDEMaxEmissionMultiplier: 0
+ - _GITDEMaxLight: 1
+ - _GITDEMinEmissionMultiplier: 1
+ - _GITDEMinLight: 0
+ - _GITDEWorldOrMesh: 0
+ - _GlitchTime: 1
+ - _Gloss: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0.5
+ - _GlossyReflections: 1
+ - _HardSpecular: 0
+ - _HeightThreshold: 0.98
+ - _HighlightEmission: 0
+ - _HoloCenterTransparency: 0.2
+ - _HoloEmission: 0.5
+ - _HoloLineDensity: 500
+ - _HoloPanSpeed: 5
+ - _HoloTransparency: 0.75
+ - _IOR: 1.45
+ - _IndirectContribution: 0
+ - _InvertSmoothness: 0
+ - _LightingAOUV: 0
+ - _LightingIndirectContribution: 0.25
+ - _LightingMinLightBrightness: 0
+ - _LightingStandardControlsToon: 0
+ - _LightingStandardSmoothness: 0
+ - _LightingType: 0
+ - _LineworkEmission: 0
+ - _Lit: 0
+ - _MainAlphaToCoverage: 1
+ - _MainEmissionStrength: 0
+ - _MainMinAlpha: 0
+ - _MainMipScale: 0.25
+ - _MainTextureUV: 0
+ - _Matcap2Add: 0
+ - _Matcap2Border: 0.43
+ - _Matcap2Enable: 0
+ - _Matcap2Intensity: 1
+ - _Matcap2LightMask: 0
+ - _Matcap2Multiply: 0
+ - _Matcap2Replace: 0
+ - _MatcapAdd: 0
+ - _MatcapBorder: 0.43
+ - _MatcapBrightness: 1
+ - _MatcapEnable: 0
+ - _MatcapIntensity: 1
+ - _MatcapLightMask: 0
+ - _MatcapMultiply: 0
+ - _MatcapReplace: 1
+ - _MatcapStrength: 1
+ - _MaxBrightness: 1
+ - _MaxDirectionalIntensity: 1
+ - _Metallic: 0
+ - _MinBrightness: 0
+ - _Mirror: 0
+ - _Mode: 0
+ - _ModelAngleMax: 90
+ - _ModelAngleMin: 45
+ - _MultiplyMatcap: 0
+ - _OcclusionStrength: 1
+ - _OutlineStencilCompareFunction: 8
+ - _OutlineStencilFailOp: 0
+ - _OutlineStencilPassOp: 0
+ - _OutlineStencilReadMaskRef: 0
+ - _OutlineStencilRef: 0
+ - _OutlineStencilWriteMaskRef: 0
+ - _OutlineStencilZFailOp: 0
+ - _PanoBlend: 0
+ - _PanoCubeMapToggle: 0
+ - _PanoEmission: 0
+ - _PanoToggle: 0
+ - _Parallax: 0.02
+ - _ParallaxBias: 0.42
+ - _ParallaxHeightIterations: 1
+ - _ParallaxHeightMapEnabled: 0
+ - _ParallaxInternalHeightFromAlpha: 0
+ - _ParallaxInternalHeightmapMode: 0
+ - _ParallaxInternalIterations: 1
+ - _ParallaxInternalMapEnabled: 0
+ - _ParallaxInternalMaxDepth: 1
+ - _ParallaxInternalMaxFade: 0
+ - _ParallaxInternalMinDepth: 0
+ - _ParallaxInternalMinFade: 1
+ - _ParallaxMap: 0
+ - _ParallaxStrength: 0
+ - _ParticleAlphaCutoff: 0
+ - _ParticleFlipParticlesGoingInward: 0
+ - _ParticleFlipbookCurrentFrame: -1
+ - _ParticleFlipbookFPS: 30
+ - _ParticleFlipbookTotalFrames: 1
+ - _ParticleLinearEndAlpha: 1
+ - _ParticleLinearEndSizeMin: 0
+ - _ParticleLinearEndsizeMax: 0
+ - _ParticleLinearNormalRange: -1
+ - _ParticleLinearSpeedMax: 10
+ - _ParticleLinearSpeedMin: 0.1
+ - _ParticleLinearStartAlpha: 1
+ - _ParticleLinearStartSizeMax: 0.02
+ - _ParticleLinearStartSizeMin: 0.02
+ - _ParticleLit: 0
+ - _ParticleMinRenderDistance: 0.2
+ - _ParticleMovementMode: 0
+ - _ParticlePerCMSquared: 1
+ - _ParticleRandomRotation: 0
+ - _ParticleRandomTimeOffset: 0
+ - _ParticleRotation: 0
+ - _ParticleScaleMax: 0.02
+ - _ParticleScaleMin: 0.01
+ - _ParticleSphericalMaxRadius: 0.2
+ - _ParticleSphericalMaxSpeed: 5
+ - _ParticleSphericalMinRadius: 0
+ - _ParticleSphericalMinSpeed: -5
+ - _ParticleStencilCompareFunction: 8
+ - _ParticleStencilFailOp: 0
+ - _ParticleStencilPassOp: 0
+ - _ParticleStencilRef: 0
+ - _ParticleStencilZFailOp: 0
+ - _Pieces: 20
+ - _PurelyAdditive: 0
+ - _RefractionChromaticAberattion: 0
+ - _RefractionIndex: 1.333333
+ - _ReplaceWithMatcap: 0
+ - _RimBrighten: 0
+ - _RimEnviroBlur: 0.7
+ - _RimEnviroMinBrightness: 0
+ - _RimEnviroSharpness: 0
+ - _RimEnviroWidth: 0.45
+ - _RimLightColorBias: 0
+ - _RimLightingInvert: 0
+ - _RimSharpness: 0.25
+ - _RimStrength: 0
+ - _RimWidth: 0.8
+ - _RimWidthNoiseStrength: 0.1
+ - _Roughness: 0
+ - _SSSAttenuation: 0
+ - _SSSDistortion: 0
+ - _SSSPower: 1
+ - _SSSSCale: 0
+ - _SSSThicknessMod: 0
+ - _SampleWorld: 0
+ - _Saturation: 0
+ - _ScrollingEmission: 0
+ - _ShadowMix: 0
+ - _ShadowMixThreshold: 0.5
+ - _ShadowMixWidthMod: 0.5
+ - _ShadowOffset: 0
+ - _ShadowStrength: 1
+ - _ShowUnderWave: 1
+ - _Smoothness: 0
+ - _SmoothnessFrom: 1
+ - _SmoothnessTextureChannel: 0
+ - _SourceBlend: 5
+ - _SpawnAlpha: 0.7
+ - _Spec2Smoothness: 0
+ - _SpecWhatTangent: 0
+ - _SpecularBias: 0
+ - _SpecularColorFrom: 0
+ - _SpecularHighlights: 1
+ - _SpecularInvertSmoothness: 0
+ - _SpecularMinLightBrightness: 0
+ - _SpecularMixAlbedoIntoTint: 0
+ - _SpecularSize: 0.005
+ - _SpecularSmoothness: 0
+ - _SpecularStrength: 0
+ - _SpecularType: 0
+ - _SrcBlend: 1
+ - _StencilCompareFunction: 8
+ - _StencilFailOp: 0
+ - _StencilPassOp: 0
+ - _StencilReadMaskRef: 0
+ - _StencilRef: 0
+ - _StencilWriteMaskRef: 0
+ - _StencilZFailOp: 0
+ - _TriToCube: 1
+ - _UVSec: 0
+ - _UnderWaveEmission: 2
+ - _VoronoiCells: 3
+ - _VoronoiSpeed: 0.33
+ - _WaveEmission: 2
+ - _WaveHeight: 0.01
+ - _ZBias: 0
+ - _ZTest: 4
+ - _ZWrite: 1
+ - footer_discord: 0
+ - footer_github: 0
+ - footer_patreon: 0
+ - footer_twitter: 0
+ - footer_youtube: 0
+ - m_CubedOptions: 1
+ - m_HologramOptions: 0
+ - m_RandomOptions: 0
+ - m_RefractionOptions: 0
+ - m_StencilPassOptions: 0
+ - m_TouchOptions: 0
+ - m_bakedLighting: 0
+ - m_debugOptions: 0
+ - m_dissolve: 0
+ - m_emissionOptions: 0
+ - m_end_Alpha: 0
+ - m_end_Angle: 0
+ - m_end_Anisotropic: 0
+ - m_end_CenterOutEmission: 0
+ - m_end_Depth: 0
+ - m_end_DetailOptions: 0
+ - m_end_Fade: 0
+ - m_end_LinearMotion: 0
+ - m_end_Matcap2: 0
+ - m_end_OutlineStencil: 0
+ - m_end_ParticleFlipbook: 0
+ - m_end_ParticleStencilPassOptions: 0
+ - m_end_ShadowMix: 0
+ - m_end_SpecularToon: 0
+ - m_end_blinkingEmissionOptions: 0
+ - m_end_clearCoat: 0
+ - m_end_constructedMode: 0
+ - m_end_explodeMode: 0
+ - m_end_furAdvanced: 0
+ - m_end_glowInDarkEmissionOptions: 0
+ - m_end_lightingAdvanced: 0
+ - m_end_lightingBeta: 0
+ - m_end_lightingStandard: 0
+ - m_end_mainAdvanced: 0
+ - m_end_manualFlipbookControl: 0
+ - m_end_manualParticleFlipbookControl: 0
+ - m_end_parallaxAdvanced: 0
+ - m_end_parallaxHeightmap: 0
+ - m_end_parallaxInternal: 0
+ - m_end_pointToPoint: 0
+ - m_end_reflectionRim: 0
+ - m_end_rimWidthNoise: 0
+ - m_end_scrollingEmissionOptions: 0
+ - m_end_sphericalMotion: 0
+ - m_fakeLightingOptions: 0
+ - m_flipBook: 0
+ - m_funOptions: 0
+ - m_furOptions: 0
+ - m_lavaOptions: 0
+ - m_mainOptions: 0
+ - m_matcapOptions: 0
+ - m_metallicOptions: 0
+ - m_mirrorOptions: 0
+ - m_miscOptions: 0
+ - m_panosphereOptions: 0
+ - m_parallaxMap: 0
+ - m_particleOptions: 0
+ - m_renderingOptions: 0
+ - m_rimLightOptions: 0
+ - m_shatterWave: 0
+ - m_specularHighlightsOptions: 0
+ - m_start_Alpha: 0
+ - m_start_Angle: 0
+ - m_start_Anisotropic: 0
+ - m_start_CenterOutEmission: 0
+ - m_start_Depth: 0
+ - m_start_DetailOptions: 0
+ - m_start_Fade: 0
+ - m_start_LinearMotion: 0
+ - m_start_Matcap2: 0
+ - m_start_OutlineStencil: 0
+ - m_start_ParticleFlipbook: 0
+ - m_start_ParticleStencilPassOptions: 0
+ - m_start_ShadowMix: 0
+ - m_start_SpecularToon: 0
+ - m_start_blinkingEmissionOptions: 0
+ - m_start_clearCoat: 0
+ - m_start_constructedMode: 0
+ - m_start_explodeMode: 0
+ - m_start_furAdvanced: 0
+ - m_start_glowInDarkEmissionOptions: 0
+ - m_start_lightingAdvanced: 0
+ - m_start_lightingBeta: 0
+ - m_start_lightingStandard: 0
+ - m_start_mainAdvanced: 0
+ - m_start_manualFlipbookControl: 0
+ - m_start_manualParticleFlipbookControl: 0
+ - m_start_parallaxAdvanced: 0
+ - m_start_parallaxHeightmap: 0
+ - m_start_parallaxInternal: 0
+ - m_start_pointToPoint: 0
+ - m_start_reflectionRim: 0
+ - m_start_rimWidthNoise: 0
+ - m_start_scrollingEmissionOptions: 0
+ - m_start_sphericalMotion: 0
+ - m_subsurfaceOptions: 0
+ - m_textureBlending: 0
+ - shader_is_using_thry_editor: 69.12
+ - shader_master_label: 0
+ - shader_presets: 0
+ - shader_properties_label_file: 0
+ m_Colors:
+ - _AngleForwardDirection: {r: 0, g: 0, b: 1, a: 0}
+ - _AssemblyBegin: {r: 0, g: -1, b: 0, a: 0}
+ - _AssemblyEnd: {r: 0, g: 1, b: 0, a: 0}
+ - _BackTexturePan: {r: 0, g: 0, b: 0, a: 0}
+ - _BackgroundColor: {r: 1, g: 0.09999997, b: 0.09999997, a: 1}
+ - _BlendTextureColor: {r: 1, g: 1, b: 1, a: 1}
+ - _ClearCoatTint: {r: 1, g: 1, b: 1, a: 1}
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
+ - _DepthGlowColor: {r: 1, g: 1, b: 1, a: 1}
+ - _DetailTexturePan: {r: 0, g: 0, b: 0, a: 0}
+ - _DetailTint: {r: 1, g: 1, b: 1, a: 1}
+ - _DissolveEdgeColor: {r: 1, g: 1, b: 1, a: 1}
+ - _DissolveEndPoint: {r: 0, g: 1, b: 0, a: 0}
+ - _DissolvePan: {r: 0, g: 0, b: 0, a: 0}
+ - _DissolveStartPoint: {r: 0, g: -1, b: 0, a: 0}
+ - _DissolveTextureColor: {r: 1, g: 1, b: 1, a: 1}
+ - _DissolveToPanning: {r: 0, g: 0, b: 0, a: 0}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+ - _EmissionPan: {r: 0, g: 0, b: 0, a: 0}
+ - _EmissionScrollSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _EmissiveScroll_Direction: {r: 0, g: -10, b: 0, a: 0}
+ - _FlipbookColor: {r: 1, g: 1, b: 1, a: 1}
+ - _FlipbookScaleOffset: {r: 1, g: 1, b: 0, a: 0}
+ - _ForegroundColor: {r: 1, g: 1, b: 1, a: 1}
+ - _FrontTexturePan: {r: 0, g: 0, b: 0, a: 0}
+ - _FurColor: {r: 1, g: 1, b: 1, a: 1}
+ - _GlobalPanSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _GradientBackColor: {r: 1, g: 1, b: 1, a: 1}
+ - _GradientFrontColor: {r: 1, g: 1, b: 1, a: 1}
+ - _HighlightColor: {r: 1, g: 1, b: 1, a: 1}
+ - _HoloLineWidth: {r: 0, g: 0.5, b: 0, a: 0}
+ - _HoloPanDirection: {r: 0, g: 1, b: 0, a: 0}
+ - _HoloTint: {r: 0, g: 1, b: 1, a: 1}
+ - _LightDirection: {r: 0, g: 1, b: 0, a: 0}
+ - _LineworkColor: {r: 1, g: 1, b: 1, a: 1}
+ - _LocalSpawnOffset: {r: 0, g: 0, b: 0, a: 0}
+ - _MainDetailNormalPan: {r: 0, g: 0, b: 0, a: 0}
+ - _MainDistanceFade: {r: 0, g: 0, b: 0, a: 0}
+ - _MainNormalPan: {r: 0, g: 0, b: 0, a: 0}
+ - _Matcap2Color: {r: 1, g: 1, b: 1, a: 1}
+ - _MatcapColor: {r: 1, g: 1, b: 1, a: 1}
+ - _MetalReflectionTint: {r: 1, g: 1, b: 1, a: 1}
+ - _NameColor: {r: 0, g: 0, b: 0, a: 0}
+ - _NamePan: {r: 0.1, g: 0, b: 0, a: 0}
+ - _NoiseBackPanSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _NoiseFrontPanSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _NoisePan: {r: 0, g: 0.3, b: 0, a: 0}
+ - _PanosphereColor: {r: 1, g: 1, b: 1, a: 1}
+ - _PanospherePan: {r: 0, g: 0, b: 0, a: 0}
+ - _PanosphereScroll: {r: 0, g: 0, b: 0, a: 0}
+ - _ParallaxInternalMaxColor: {r: 1, g: 1, b: 1, a: 1}
+ - _ParallaxInternalMinColor: {r: 1, g: 1, b: 1, a: 1}
+ - _ParallaxInternalPanDepthSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _ParallaxInternalPanSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _ParticleColor: {r: 1, g: 1, b: 1, a: 1}
+ - _ParticleLinearEndOffsetMax: {r: -0.05, g: -0.05, b: -0.05, a: 0}
+ - _ParticleLinearEndOffsetMin: {r: 0.05, g: 0.05, b: 0.05, a: 0}
+ - _RimLightColor: {r: 1, g: 1, b: 1, a: 1}
+ - _RimTexPanSpeed: {r: 0, g: 0, b: 0, a: 0}
+ - _RimWidthNoisePan: {r: 0, g: 0, b: 0, a: 0}
+ - _SSSColor: {r: 1, g: 1, b: 1, a: 1}
+ - _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
+ - _SpecularTint: {r: 1, g: 1, b: 1, a: 1}
+ - _SpecularToonInnerOuter: {r: 0.25, g: 0.3, b: 0, a: 1}
+ - _WaveColor: {r: 1, g: 1, b: 1, a: 1}
+ - _WaveDensity: {r: 10, g: 8, b: 9, a: 0}
+ - _WaveSlope: {r: 2, g: 2, b: 2, a: 0}
+ - _WaveSpeed: {r: 0.5, g: 0.6, b: 0.7, a: 0}
+ - _WorldSpawnOffset: {r: 0, g: 0, b: 0, a: 0}
+ - _underWaveColor: {r: 1, g: 1, b: 1, a: 1}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/Cubed.mat.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/Cubed.mat.meta
new file mode 100644
index 00000000..e2b9ed0c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/Cubed.mat.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ff209eec2e436e048a20f736af35fb23
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/PoiyomiCubed.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/PoiyomiCubed.shader
new file mode 100644
index 00000000..7b9924e4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/PoiyomiCubed.shader
@@ -0,0 +1,259 @@
+Shader ".poiyomi/Patreon/Cubed"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#008080>Poiyomi³</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color", Color) = (1, 1, 1, 1)
+ _Desaturation ("Saturation", Range(-1, 1)) = 0
+ _MainTex ("Texture", 2D) = "white" { }
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, DistortedUV1, 4)] _MainTextureUV ("Tex UV#", Int) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _AlphaMask ("Alpha Mask", 2D) = "white" { }
+ _Clip ("Alpha Cuttoff", Range(0, 1.001)) = 0.5
+ [HideInInspector] m_start_mainAdvanced ("Advanced", Float) = 0
+ _GlobalPanSpeed ("Pan Speed XY", Vector) = (0, 0, 0, 0)
+ [Normal]_DetailNormalMap ("Detail Map", 2D) = "bump" { }
+ _DetailNormalMask ("Detail Mask", 2D) = "white" { }
+ _DetailNormalMapScale ("Detail Intensity", Range(0, 10)) = 1
+ [HideInInspector] m_end_mainAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_CubedOptions ("Cubed Options", Float) = 0
+ [Enum(Random, 0, Constructed, 1)] _AssemblyMode("Assembly Mode", Int) = 0
+ _TriToCube ("Tri to Cube", Range(0,1)) = 0
+ _SpawnAlpha ("Spawn Alpha", Range(0,1)) = 0
+ _LocalSpawnOffset ("Local Spawn Offset", Vector) = (0, 0, 0, 0)
+ _WorldSpawnOffset ("World Spawn Offset", Vector) = (0, 0, 0, 0)
+ _Pieces ("Pieces", Float) = 20
+ [HideInInspector] m_start_constructedMode ("Constructed Mode", Float) = 0
+ _AssemblyBegin ("Assembly Begin", Vector) = (0, -1, 0, 0)
+ _AssemblyEnd ("Assembly End", Vector) = (0, 1, 0, 0)
+ [Enum(Off, 0, On, 1)] _CubeGradientDebug("Debug View", Int) = 0
+ [HideInInspector] m_end_constructedMode ("Constructed Mode", Float) = 0
+ [HideInInspector] m_start_explodeMode ("Explode Mode", Float) = 0
+ [Enum(Off, 0, On, 1)] _ExplodeMode("Assembly Mode", Int) = 0
+ _ExplodeFadeDistance ("Explode Fade Distance", Float) = .3
+ [HideInInspector] m_end_explodeMode ("Explode Mode", Float) = 0
+
+ [HideInInspector] m_metallicOptions ("Metallic", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _PurelyAdditive ("Purely Additive", Range(0, 1)) = 0
+ _MetallicMap ("Metallic Map", 2D) = "white" { }
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMap ("Smoothness Map", 2D) = "white" { }
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+
+ [HideInInspector] m_matcapOptions ("Matcap / Sphere Textures", Float) = 0
+ _Matcap ("Matcap", 2D) = "white" { }
+ _MatcapMap ("Matcap Map", 2D) = "white" { }
+ _MatcapColor ("Matcap Color", Color) = (1, 1, 1, 1)
+ _MatcapStrength ("Matcap Strength", Range(0, 20)) = 1
+ _ReplaceWithMatcap ("Replace With Matcap", Range(0, 1)) = 0
+ _MultiplyMatcap ("Multiply Matcap", Range(0, 1)) = 0
+ _AddMatcap ("Add Matcap", Range(0, 1)) = 0
+
+ [HideInInspector] m_emissionOptions ("Emission", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ _EmissionMap ("Emission Map", 2D) = "white" { }
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ _EmissionScrollSpeed ("Emission Scroll Speed", Vector) = (0, 0, 0, 0)
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 1
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ [HideInInspector] m_fakeLightingOptions ("Lighting", Float) = 0
+ [Enum(Natural, 0, Controlled, 1)] _LightingType("Lighting Type", Int) = 0
+ [Gradient]_ToonRamp ("Lighting Ramp", 2D) = "white" { }
+ _ShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ _ShadowOffset ("Shadow Offset", Range(-1, 1)) = 0
+ _MinBrightness ("Min Brightness", Range(0, 1)) = 0
+ _MaxBrightness ("Max Brightness", Float) = 1
+ _AOMap ("AO Map", 2D) = "white" { }
+ _AOStrength ("AO Strength", Range(0, 1)) = 1
+ [HideInInspector] m_start_lightingAdvanced ("Advanced", Float) = 0
+ _IndirectContribution ("Indirect Contribution", Range(0, 1)) = 0
+ _AdditiveSoftness ("Additive Softness", Range(0, 0.5)) = 0.05
+ _AdditiveOffset ("Additive Offset", Range(-0.5, 0.5)) = 0
+ _AttenuationMultiplier ("Attenuation", Range(0, 1)) = 0
+ [HideInInspector] m_end_lightingAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_specularHighlightsOptions ("Specular Highlights", Float) = 0
+ [Enum(Off, 0, Realistic, 1, Toon, 2, soon.jpg, 3)] _SpecularType ("Specular Type", Int) = 0
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularSmoothness ("Smoothness", Range(0, 1)) = 0
+ _SpecularMap ("Specular Map", 2D) = "white" { }
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ _SpecularHighTexture ("Specular High Tex", 2D) = "white" { }
+ [Enum(Lighting, 0, HighTexture, 1)] _SpecularColorFrom("Specular Color From", Int) = 0
+
+ [HideInInspector] m_subsurfaceOptions ("Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 1, 1, 1)
+ _SSSThicknessMap ("Thickness Map", 2D) = "black" { }
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSStrength ("Attenuation", Range(0, 1)) = 0
+ _SSSPower ("Light Spread", Range(1, 100)) = 1
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 0
+
+ [HideInInspector] m_rimLightOptions ("Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 0
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ _RimTexPanSpeed ("Rim Texture Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+
+ [HideInInspector] m_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ [IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+
+ [HideInInspector] m_funOptions ("Fun", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+
+ [HideInInspector] m_miscOptions ("Misc", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+
+ }
+
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" }
+
+ Pass
+ {
+ Name "MainPass"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMaskRef]
+ WriteMask [_StencilWriteMaskRef]
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_BASE_PASS
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma geometry geom
+ #include "../Includes/PoiDefaultPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMaskRef]
+ WriteMask [_StencilWriteMaskRef]
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_ADD_PASS
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma geometry geom
+ #include "../Includes/PoiDefaultPass.cginc"
+ ENDCG
+
+ }
+ /*
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMaskRef]
+ WriteMask [_StencilWriteMaskRef]
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define CUTOUT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/PoiPassShadow.cginc"
+ ENDCG
+
+ }
+ */
+ }
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/PoiyomiCubed.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/PoiyomiCubed.shader.meta
new file mode 100644
index 00000000..024e9a08
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Patreon/VoxelCubed/Shader/PoiyomiCubed.shader.meta
@@ -0,0 +1,27 @@
+fileFormatVersion: 2
+guid: cd0442380db86bb4783e70d0dd6a7e96
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {instanceID: 0}
+ - _BumpMap: {instanceID: 0}
+ - _AlphaMask: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _DetailNormalMask: {instanceID: 0}
+ - _CubeMap: {instanceID: 0}
+ - _MetallicMap: {instanceID: 0}
+ - _SmoothnessMap: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMap: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _ToonRamp: {fileID: 2800000, guid: 7744a2dff3641604fa8b6601a055824c, type: 3}
+ - _AOMap: {instanceID: 0}
+ - _SpecularMap: {instanceID: 0}
+ - _SpecularHighTexture: {instanceID: 0}
+ - _SSSThicknessMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ - _RimMask: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro.meta
new file mode 100644
index 00000000..35f87d86
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3babf9055711f064b9986fcf64bf1164
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes.meta
new file mode 100644
index 00000000..4908ac7d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7ef672f9cf9e2ff4e816febc559a75de
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_FunctionsArtistic.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_FunctionsArtistic.cginc
new file mode 100644
index 00000000..8d98417c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_FunctionsArtistic.cginc
@@ -0,0 +1,369 @@
+#ifndef POI_FUNCTIONS_ARTISTIC
+ #define POI_FUNCTIONS_ARTISTIC
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ float3 hueShift(float3 color, float Offset)
+ {
+ float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
+ float4 P = lerp(float4(color.bg, K.wz), float4(color.gb, K.xy), step(color.b, color.g));
+ float4 Q = lerp(float4(P.xyw, color.r), float4(color.r, P.yzx), step(P.x, color.r));
+ float D = Q.x - min(Q.w, Q.y);
+ float E = 0.0000000001;
+ float3 hsv = float3(abs(Q.z + (Q.w - Q.y) / (6.0 * D + E)), D / (Q.x + E), Q.x);
+
+ float hue = hsv.x + Offset;
+ hsv.x = frac(hue);
+
+ float4 K2 = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ float3 P2 = abs(frac(hsv.xxx + K2.xyz) * 6.0 - K2.www);
+ return hsv.z * lerp(K2.xxx, saturate(P2 - K2.xxx), hsv.y);
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0): float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r): float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 HCYtoRGB(in float3 HCY)
+ {
+
+
+ float3 RGB = HUEtoRGB(HCY.x);
+ float Z = dot(RGB, HCYwts);
+ if (HCY.z < Z)
+ {
+ HCY.y *= HCY.z / Z;
+ }
+ else if(Z < 1)
+ {
+ HCY.y *= (1 - HCY.z) / (1 - Z);
+ }
+ return(RGB - Z) * HCY.y + HCY.z;
+ }
+
+ float3 RGBtoHCY(in float3 RGB)
+ {
+ // Corrected by David Schaeffer
+ float3 HCV = RGBtoHCV(RGB);
+ float Y = dot(RGB, HCYwts);
+ float Z = dot(HUEtoRGB(HCV.x), HCYwts);
+ if (Y < Z)
+ {
+ HCV.y *= Z / (Epsilon + Y);
+ }
+ else
+ {
+ HCV.y *= (1 - Z) / (Epsilon + 1 - Y);
+ }
+ return float3(HCV.x, HCV.y, Y);
+ }
+
+ float3 HCLtoRGB(in float3 HCL)
+ {
+ float3 RGB = 0;
+ if(HCL.z != 0)
+ {
+ float H = HCL.x;
+ float C = HCL.y;
+ float L = HCL.z * HCLmaxL;
+ float Q = exp((1 - C / (2 * L)) * (HCLgamma / HCLy0));
+ float U = (2 * L - C) / (2 * Q - 1);
+ float V = C / Q;
+ float A = (H + min(frac(2 * H) / 4, frac(-2 * H) / 8)) * pi * 2;
+ float T;
+ H *= 6;
+ if(H <= 0.999)
+ {
+ T = tan(A);
+ RGB.r = 1;
+ RGB.g = T / (1 + T);
+ }
+ else if(H <= 1.001)
+ {
+ RGB.r = 1;
+ RGB.g = 1;
+ }
+ else if(H <= 2)
+ {
+ T = tan(A);
+ RGB.r = (1 + T) / T;
+ RGB.g = 1;
+ }
+ else if(H <= 3)
+ {
+ T = tan(A);
+ RGB.g = 1;
+ RGB.b = 1 + T;
+ }
+ else if(H <= 3.999)
+ {
+ T = tan(A);
+ RGB.g = 1 / (1 + T);
+ RGB.b = 1;
+ }
+ else if(H <= 4.001)
+ {
+ RGB.g = 0;
+ RGB.b = 1;
+ }
+ else if(H <= 5)
+ {
+ T = tan(A);
+ RGB.r = -1 / T;
+ RGB.b = 1;
+ }
+ else
+ {
+ T = tan(A);
+ RGB.r = 1;
+ RGB.b = -T;
+ }
+ RGB = RGB * V + U;
+ }
+ return RGB;
+ }
+
+ float3 RGBtoHCL(in float3 RGB)
+ {
+ float3 HCL;
+ float H = 0;
+ float U = min(RGB.r, min(RGB.g, RGB.b));
+ float V = max(RGB.r, max(RGB.g, RGB.b));
+ float Q = HCLgamma / HCLy0;
+ HCL.y = V - U;
+ if(HCL.y != 0)
+ {
+ H = atan2(RGB.g - RGB.b, RGB.r - RGB.g) / pi;
+ Q *= U / V;
+ }
+ Q = exp(Q);
+ HCL.x = frac(H / 2 - min(frac(H), frac(-H)) / 6);
+ HCL.y *= Q;
+ HCL.z = lerp(-U, V, Q) / (HCLmaxL * 2);
+ return HCL;
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + pi * 3., TAU) - pi;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_FunctionsArtistic.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_FunctionsArtistic.cginc.meta
new file mode 100644
index 00000000..cfdb6a63
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_FunctionsArtistic.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 2e376fd109ce87a41b889d93e88c6639
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAlphaToCoverage.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAlphaToCoverage.cginc
new file mode 100644
index 00000000..3abae393
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAlphaToCoverage.cginc
@@ -0,0 +1,32 @@
+#ifndef POI_ALPHA_TO_COVERAGE
+ #define POI_ALPHA_TO_COVERAGE
+
+ half _MainMipScale;
+ float _MainAlphaToCoverage;
+
+ 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);
+ }
+
+ void ApplyAlphaToCoverage(inout float4 finalColor)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if(_MainAlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ finalColor.a *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _MainMipScale;
+ // rescale alpha by partial derivative
+ finalColor.a = (finalColor.a - _Cutoff) / max(fwidth(finalColor.a), 0.0001) + _Cutoff;
+ }
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAlphaToCoverage.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAlphaToCoverage.cginc.meta
new file mode 100644
index 00000000..d513e5dd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAlphaToCoverage.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 89ff22574b0f92e49a4b10267d737637
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAudioLink.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAudioLink.cginc
new file mode 100644
index 00000000..ed847502
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAudioLink.cginc
@@ -0,0 +1,128 @@
+#ifndef POI_AUDIOLINK
+#define POI_AUDIOLINK
+
+UNITY_DECLARE_TEX2D(_AudioTexture);
+float4 _AudioTexture_ST;
+fixed _AudioLinkDelay;
+fixed _AudioLinkAveraging;
+fixed _AudioLinkAverageRange;
+
+// Debug
+fixed _EnableAudioLinkDebug;
+fixed _AudioLinkDebugTreble;
+fixed _AudioLinkDebugHighMid;
+fixed _AudioLinkDebugLowMid;
+fixed _AudioLinkDebugBass;
+fixed _AudioLinkDebugAnimate;
+fixed _AudioLinkTextureVisualization;
+fixed _AudioLinkAnimToggle;
+
+void AudioTextureExists()
+{
+ half testw = 0;
+ half testh = 0;
+ _AudioTexture.GetDimensions(testw, testh);
+ poiMods.audioLinkTextureExists = testw >= 32;
+ poiMods.audioLinkTextureExists *= _AudioLinkAnimToggle;
+ switch(testw)
+ {
+ case 32: // V1
+ poiMods.audioLinkVersion = 1;
+ break;
+ case 128: // V2
+ poiMods.audioLinkVersion = 2;
+ break;
+ default:
+ poiMods.audioLinkVersion = 1;
+ break;
+ }
+}
+
+float getBandAtTime(float band, fixed time, fixed width)
+{
+ float versionUvMultiplier = 1;
+
+ if (poiMods.audioLinkVersion == 2)
+ {
+ versionUvMultiplier = 0.0625;
+ }
+ return UNITY_SAMPLE_TEX2D(_AudioTexture, float2(time * width, (band * .25 + .125) * versionUvMultiplier)).r;
+}
+
+void initAudioBands()
+{
+ AudioTextureExists();
+
+ float versionUvMultiplier = 1;
+
+ if (poiMods.audioLinkVersion == 2)
+ {
+ versionUvMultiplier = 0.0625;
+ }
+
+ if (poiMods.audioLinkTextureExists)
+ {
+ poiMods.audioLink.x = UNITY_SAMPLE_TEX2D(_AudioTexture, float2(_AudioLinkDelay, .125 * versionUvMultiplier));
+ poiMods.audioLink.y = UNITY_SAMPLE_TEX2D(_AudioTexture, float2(_AudioLinkDelay, .375 * versionUvMultiplier));
+ poiMods.audioLink.z = UNITY_SAMPLE_TEX2D(_AudioTexture, float2(_AudioLinkDelay, .625 * versionUvMultiplier));
+ poiMods.audioLink.w = UNITY_SAMPLE_TEX2D(_AudioTexture, float2(_AudioLinkDelay, .875 * versionUvMultiplier));
+
+ UNITY_BRANCH
+ if (_AudioLinkAveraging)
+ {
+ float uv = saturate(_AudioLinkDelay + _AudioLinkAverageRange * .25);
+ poiMods.audioLink.x += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .125 * versionUvMultiplier));
+ poiMods.audioLink.y += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .375 * versionUvMultiplier));
+ poiMods.audioLink.z += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .625 * versionUvMultiplier));
+ poiMods.audioLink.w += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .875 * versionUvMultiplier));
+
+ uv = saturate(_AudioLinkDelay + _AudioLinkAverageRange * .5);
+ poiMods.audioLink.x += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .125 * versionUvMultiplier));
+ poiMods.audioLink.y += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .375 * versionUvMultiplier));
+ poiMods.audioLink.z += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .625 * versionUvMultiplier));
+ poiMods.audioLink.w += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .875 * versionUvMultiplier));
+
+ uv = saturate(_AudioLinkDelay + _AudioLinkAverageRange * .75);
+ poiMods.audioLink.x += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .125 * versionUvMultiplier));
+ poiMods.audioLink.y += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .375 * versionUvMultiplier));
+ poiMods.audioLink.z += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .625 * versionUvMultiplier));
+ poiMods.audioLink.w += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .875 * versionUvMultiplier));
+
+ uv = saturate(_AudioLinkDelay + _AudioLinkAverageRange);
+ poiMods.audioLink.x += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .125 * versionUvMultiplier));
+ poiMods.audioLink.y += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .375 * versionUvMultiplier));
+ poiMods.audioLink.z += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .625 * versionUvMultiplier));
+ poiMods.audioLink.w += UNITY_SAMPLE_TEX2D(_AudioTexture, float2(uv, .875 * versionUvMultiplier));
+
+ poiMods.audioLink /= 5;
+ }
+ }
+
+ #ifndef OPTIMIZER_ENABLED
+ UNITY_BRANCH
+ if (_EnableAudioLinkDebug)
+ {
+ poiMods.audioLink.x = _AudioLinkDebugBass;
+ poiMods.audioLink.y = _AudioLinkDebugLowMid;
+ poiMods.audioLink.z = _AudioLinkDebugHighMid;
+ poiMods.audioLink.w = _AudioLinkDebugTreble;
+
+ if (_AudioLinkDebugAnimate)
+ {
+ poiMods.audioLink.x *= (sin(_Time.w * 3.1) + 1) * .5;
+ poiMods.audioLink.y *= (sin(_Time.w * 3.2) + 1) * .5;
+ poiMods.audioLink.z *= (sin(_Time.w * 3.3) + 1) * .5;
+ poiMods.audioLink.w *= (sin(_Time.w * 3) + 1) * .5;
+ }
+ poiMods.audioLinkTextureExists = 1;
+ }
+
+ UNITY_BRANCH
+ if (_AudioLinkTextureVisualization)
+ {
+ poiMods.audioLinkTexture = UNITY_SAMPLE_TEX2D(_AudioTexture, poiMesh.uv[0]);
+ }
+ #endif
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAudioLink.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAudioLink.cginc.meta
new file mode 100644
index 00000000..426cf89c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiAudioLink.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b4f547d93a614ad4d86c09ba02a0ba8d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBRDF.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBRDF.cginc
new file mode 100644
index 00000000..5dade8c0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBRDF.cginc
@@ -0,0 +1,254 @@
+#ifndef POI_BRDF
+#define POI_BRDF
+
+/*
+* MIT License
+*
+* Copyright (c) 2020 Xiexe
+*
+* 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
+* 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.
+*/
+
+#if defined(PROP_BRDFMETALLICGLOSSMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_BRDFMetallicGlossMap);
+#endif
+#if defined(PROP_BRDFSPECULARMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_BRDFSpecularMap);
+#endif
+#if defined(PROP_BRDFMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_BRDFMetallicMap);
+#endif
+
+samplerCUBE _BRDFFallback;
+
+float _BRDFMetallic;
+float _BRDFGlossiness;
+float _BRDFReflectance;
+float _BRDFAnisotropy;
+float _BRDFReflectionsEnabled;
+float _BRDFSpecularEnabled;
+float _BRDFInvertGlossiness;
+float _BRDFForceFallback;
+float _BRDFMetallicSpecIgnoresBaseColor;
+
+bool DoesReflectionProbeExist()
+{
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiCam.reflectionDir, UNITY_SPECCUBE_LOD_STEPS);
+ bool probeExists = !(unity_SpecCube0_HDR.a == 0 && envSample.a == 0);
+ return probeExists && !_BRDFForceFallback;
+}
+
+float getGeometricSpecularAA(float3 normal)
+{
+ float3 vNormalWsDdx = ddx(normal.xyz);
+ float3 vNormalWsDdy = ddy(normal.xyz);
+ float flGeometricRoughnessFactor = pow(saturate(max(dot(vNormalWsDdx.xyz, vNormalWsDdx.xyz), dot(vNormalWsDdy.xyz, vNormalWsDdy.xyz))), 0.333);
+ return max(0, flGeometricRoughnessFactor);
+}
+
+float3 getAnisotropicReflectionVector(float3 viewDir, float3 bitangent, float3 tangent, float3 normal, float roughness, float anisotropy)
+{
+ float3 anisotropicDirection = anisotropy >= 0.0 ? bitangent : tangent;
+ float3 anisotropicTangent = cross(anisotropicDirection, viewDir);
+ float3 anisotropicNormal = cross(anisotropicTangent, anisotropicDirection);
+ float bendFactor = abs(anisotropy) * saturate(5.0 * roughness);
+ float3 bentNormal = normalize(lerp(normal, anisotropicNormal, bendFactor));
+ return reflect(-viewDir, bentNormal);
+}
+
+float3 F_Schlick(float u, float3 f0)
+{
+ return f0 + (1.0 - f0) * pow(1.0 - u, 5.0);
+}
+
+float3 F_Schlick(const float3 f0, float f90, float VoH)
+{
+ // Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering"
+ float pow5 = 1.0 - VoH;
+ pow5 = pow5 * pow5 * pow5 * pow5 * pow5;
+ return f0 + (f90 - f0) * pow5;
+}
+
+float D_GGX(float NoH, float roughness)
+{
+ float a2 = roughness * roughness;
+ float f = (NoH * a2 - NoH) * NoH + 1.0;
+ return a2 / (UNITY_PI * f * f);
+}
+
+float V_SmithGGXCorrelated(float NoV, float NoL, float a)
+{
+ float a2 = a * a;
+ float GGXL = NoV * sqrt((-NoL * a2 + NoL) * NoL + a2);
+ float GGXV = NoL * sqrt((-NoV * a2 + NoV) * NoV + a2);
+ return 0.5 / (GGXV + GGXL);
+}
+
+float D_GGX_Anisotropic(float NoH, const float3 h, const float3 t, const float3 b, float at, float ab)
+{
+ float ToH = dot(t, h);
+ float BoH = dot(b, h);
+ float a2 = at * ab;
+ float3 v = float3(ab * ToH, at * BoH, a2 * NoH);
+ float v2 = dot(v, v);
+ float w2 = a2 / v2;
+ return a2 * w2 * w2 * (1.0 / UNITY_PI);
+}
+
+float3 getBoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax)
+{
+ // #if defined(UNITY_SPECCUBE_BOX_PROJECTION) // For some reason this doesn't work?
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ // #endif
+ return direction;
+}
+
+float3 getDirectSpecular(float roughness, float ndh, float vdn, float ndl, float ldh, float3 f0, float3 halfVector, float3 tangent, float3 bitangent, float anisotropy)
+{
+ #if !defined(LIGHTMAP_ON)
+ float rough = max(roughness * roughness, 0.0045);
+ float Dn = D_GGX(ndh, rough);
+ float3 F = F_Schlick(ldh, f0);
+ float V = V_SmithGGXCorrelated(vdn, ndl, rough);
+ float3 directSpecularNonAniso = max(0, (Dn * V) * F);
+
+ anisotropy *= saturate(5.0 * roughness);
+ float at = max(rough * (1.0 + anisotropy), 0.001);
+ float ab = max(rough * (1.0 - anisotropy), 0.001);
+ float D = D_GGX_Anisotropic(ndh, halfVector, tangent, bitangent, at, ab);
+ float3 directSpecularAniso = max(0, (D * V) * F);
+
+ return lerp(directSpecularNonAniso, directSpecularAniso, saturate(abs(_BRDFAnisotropy * 100))) * 3; // * 100 to prevent blending, blend because otherwise tangents are fucked on lightmapped object
+ #else
+ return 0;
+ #endif
+}
+
+float3 getIndirectSpecular(float metallic, float roughness, float3 reflDir, float3 worldPos, float3 lightmap, float3 normal)
+{
+ float3 spec = float3(0, 0, 0);
+ #if defined(UNITY_PASS_FORWARDBASE)
+ float3 indirectSpecular;
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = roughness;
+ envData.reflUVW = getBoxProjection(
+ reflDir, 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);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ envData.reflUVW = getBoxProjection(
+ reflDir, worldPos,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz
+ );
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube0_HDR, envData);
+ indirectSpecular = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ indirectSpecular = probe0;
+ }
+
+ if (!DoesReflectionProbeExist())
+ {
+ indirectSpecular = texCUBElod(_BRDFFallback, float4(reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS)).rgb * poiLight.finalLighting;
+ }
+
+ float horizon = min(1 + dot(reflDir, normal), 1);
+ indirectSpecular *= horizon * horizon;
+
+ spec = indirectSpecular;
+ #if defined(LIGHTMAP_ON)
+ float specMultiplier = max(0, lerp(1, pow(length(lightmap), _SpecLMOcclusionAdjust), _SpecularLMOcclusion));
+ spec *= specMultiplier;
+ #endif
+ #endif
+ return spec;
+}
+
+void poiBRDF(inout float4 finalColor, const float4 finalColorBeforeLighting)
+{
+ float4 ret = float4(1, 0, 0, 1);
+ #if defined(PROP_BRDFMETALLICGLOSSMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 metallicGlossMap = POI2D_SAMPLER_PAN(_BRDFMetallicGlossMap, _MainTex, poiMesh.uv[_BRDFMetallicGlossMapUV], _BRDFMetallicGlossMapPan);
+ #else
+ float4 metallicGlossMap = 1;
+ #endif
+ #if defined(PROP_BRDFSPECULARMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 spcularTintMask = POI2D_SAMPLER_PAN(_BRDFSpecularMap, _MainTex, poiMesh.uv[_BRDFSpecularMapUV], _BRDFSpecularMapPan);
+ #else
+ float4 spcularTintMask = 1;
+ #endif
+ #if defined(PROP_BRDFMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 metallicTintMask = POI2D_SAMPLER_PAN(_BRDFMetallicMap, _MainTex, poiMesh.uv[_BRDFMetallicMapUV], _BRDFMetallicMapPan);
+ #else
+ float4 metallicTintMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_BRDFInvertGlossiness == 1)
+ {
+ metallicGlossMap.a = 1 - metallicGlossMap.a;
+ }
+
+ float metallic = metallicGlossMap.r * _BRDFMetallic;
+ float reflectance = metallicGlossMap.g * _BRDFReflectance;
+ float roughness = max(1 - (_BRDFGlossiness * metallicGlossMap.a), getGeometricSpecularAA(poiMesh.normals[1]));
+ finalColor.rgb *= lerp(1, 1 - metallic, _BRDFReflectionsEnabled);
+
+ float3 reflViewDir = getAnisotropicReflectionVector(poiCam.viewDir, poiMesh.binormal, poiMesh.tangent.xyz, poiMesh.normals[1], roughness, _BRDFAnisotropy);
+ float3 reflLightDir = reflect(poiLight.direction, poiMesh.normals[1]);
+
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ float attenuation = poiMax(poiLight.rampedLightMap);
+ #endif
+ #ifdef FORWARD_ADD_PASS
+ float attenuation = saturate(poiLight.nDotL);
+ #endif
+
+
+ float3 f0 = 0.16 * reflectance * reflectance * (1.0 - metallic) + lerp(finalColorBeforeLighting.rgb * metallic, 1, _BRDFMetallicSpecIgnoresBaseColor);
+ float3 fresnel = lerp(F_Schlick(poiLight.nDotV, f0), f0, metallic); //Kill fresnel on metallics, it looks bad.
+ float3 directSpecular = getDirectSpecular(roughness, saturate(poiLight.nDotH), max(poiLight.nDotV, 0.000001), attenuation, saturate(poiLight.lDotH), f0, poiLight.halfDir, poiMesh.tangent.xyz, poiMesh.binormal, _BRDFAnisotropy) * poiLight.attenuation * attenuation * poiLight.color;
+ directSpecular = min(directSpecular, poiLight.color);
+
+ float3 vDirectSpecular = 0;
+ #ifdef VERTEXLIGHT_ON
+ for (int index = 0; index < 4; index++)
+ {
+ float3 v0directSpecular = getDirectSpecular(roughness, saturate(poiLight.vDotNH[index]), max(poiLight.nDotV, 0.000001), attenuation, saturate(poiLight.lDotH), f0, poiLight.vHalfDir[index], poiMesh.tangent, poiMesh.binormal, _BRDFAnisotropy) * poiLight.attenuation * poiLight.vAttenuationDotNL[index] * poiLight.vColor[index];
+ vDirectSpecular += min(v0directSpecular, poiLight.vColor[index]);
+ }
+ #endif
+
+ float3 indirectSpecular = getIndirectSpecular(metallic, roughness, reflViewDir, poiMesh.worldPos, /*directDiffuse*/ finalColor.rgb, poiMesh.normals[1]) * lerp(fresnel, f0, roughness);
+ float3 specular = indirectSpecular * _BRDFReflectionsEnabled * metallicTintMask.a * metallicTintMask.rgb * poiLight.occlusion + (directSpecular + vDirectSpecular) * _BRDFSpecularEnabled * spcularTintMask.a * spcularTintMask.rgb;
+ finalColor.rgb += specular;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBRDF.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBRDF.cginc.meta
new file mode 100644
index 00000000..709d8c6c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBRDF.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0543f339ffab97d418a5577bd4cd049c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBackFace.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBackFace.cginc
new file mode 100644
index 00000000..57294263
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBackFace.cginc
@@ -0,0 +1,49 @@
+#ifndef POI_BACKFACE
+#define POI_BACKFACE
+
+float _BackFaceEnabled;
+float _BackFaceTextureUV;
+float _BackFaceDetailIntensity;
+float _BackFaceEmissionStrength;
+float2 _BackFacePanning;
+float _BackFaceHueShift;
+float4 _BackFaceColor;
+float _BackFaceReplaceAlpha;
+
+#if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_BackFaceTexture); float4 _BackFaceTexture_ST;
+#endif
+
+float3 BackFaceColor;
+void applyBackFaceTexture(inout float backFaceDetailIntensity, inout float mixedHueShift, inout float4 albedo, inout float3 backFaceEmission)
+{
+ backFaceEmission = 0;
+ BackFaceColor = 0;
+ UNITY_BRANCH
+ if (_BackFaceEnabled)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ #if defined(PROP_BACKFACETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 backFaceTex = POI2D_SAMPLER_PAN(_BackFaceTexture, _MainTex, poiMesh.uv[_BackFaceTextureUV], _BackFacePanning) * _BackFaceColor;
+ #else
+ float4 backFaceTex = _BackFaceColor;
+ #endif
+
+ albedo.rgb = backFaceTex.rgb;
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ albedo.a = backFaceTex.a;
+ }
+
+ backFaceDetailIntensity = _BackFaceDetailIntensity;
+ BackFaceColor = albedo.rgb;
+ mixedHueShift = _BackFaceHueShift;
+ backFaceEmission = BackFaceColor * _BackFaceEmissionStrength;
+ }
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBackFace.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBackFace.cginc.meta
new file mode 100644
index 00000000..7e580bcc
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBackFace.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9ee086be5141bcb458615f8ad9f54d79
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlackLight.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlackLight.cginc
new file mode 100644
index 00000000..0ae60087
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlackLight.cginc
@@ -0,0 +1,56 @@
+#ifndef POI_BLACKLIGHT
+ #define POI_BLACKLIGHT
+
+ float4 _BlackLightMaskStart;
+ float4 _BlackLightMaskEnd;
+ float4 _BlackLightMaskKeys;
+ float _BlackLightMaskDebug;
+ float _BlackLightMaskDissolve;
+ float _BlackLightAdjustDissolve;
+ float _BlackLightMaskMetallic;
+ float _BlackLightMaskClearCoat;
+ float _BlackLightMaskMatcap;
+ float _BlackLightMaskMatcap2;
+ float _BlackLightMaskEmission;
+ float _BlackLightMaskEmission2;
+ float _BlackLightMaskFlipbook;
+ float _BlackLightMaskPanosphere;
+ float _BlackLightMaskIridescence;
+ float _BlackLightMove;
+
+ half _BlackLightMaskGlitter;
+
+ half4 blackLightMask;
+
+ void createBlackLightMask()
+ {
+ blackLightMask = 0;
+ #ifdef VERTEXLIGHT_ON
+
+ for (int lightIndex = 0; lightIndex < 4; lightIndex ++)
+ {
+ float3 lightPos = float3(unity_4LightPosX0[lightIndex], unity_4LightPosY0[lightIndex], unity_4LightPosZ0[lightIndex]);
+ if (!distance(unity_LightColor[lightIndex].rgb, float3(0, 0, 0)))
+ {
+ for (int maskIndex = 0; maskIndex < 4; maskIndex ++)
+ {
+ float4 comparison = _BlackLightMaskKeys;
+ if(unity_LightColor[lightIndex].a == comparison[maskIndex])
+ {
+ blackLightMask[maskIndex] = max(blackLightMask[maskIndex], smoothstep(_BlackLightMaskEnd[maskIndex], _BlackLightMaskStart[maskIndex], distance(poiMesh.worldPos, lightPos)));
+ }
+ }
+ }
+ }
+ #endif
+ }
+#endif
+
+/*
+#ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ blackLightMask[mask];
+ }
+#endif
+*/ \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlackLight.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlackLight.cginc.meta
new file mode 100644
index 00000000..bd162897
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlackLight.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 49ee29e0fa0a33c48a51991dc965e8eb
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlending.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlending.cginc
new file mode 100644
index 00000000..1016ae12
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlending.cginc
@@ -0,0 +1,385 @@
+#ifndef POI_BLENDING
+ #define POI_BLENDING
+
+ /*
+ 0: Zero float4(0.0, 0.0, 0.0, 0.0),
+ 1: One float4(1.0, 1.0, 1.0, 1.0),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return(base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return(blend == 0.0)?blend: max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlending.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlending.cginc.meta
new file mode 100644
index 00000000..ab596bdf
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBlending.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9f7b9815516b9bd45afc0657803fde91
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBulge.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBulge.cginc
new file mode 100644
index 00000000..09e44d6f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBulge.cginc
@@ -0,0 +1,41 @@
+#ifndef POI_BULGE
+ #define POI_BULGE
+
+ float _BuldgeFadeLength;
+ float _BuldgeHeight;
+
+ #if defined(PROP_BULGEMASK) || !defined(OPTIMIZER_ENABLED)
+ sampler2D _BulgeMask;
+ #endif
+
+ void bulgyWolgy(inout v2f o)
+ {
+ float depth = DecodeFloatRG(tex2Dlod(_CameraDepthTexture, float4(o.grabPos.xy / o.grabPos.w, 0, 0)));
+ #if defined(PROP_BULGEMASK) || !defined(OPTIMIZER_ENABLED)
+ float bulgeMask = tex2Dlod(_BulgeMask, float4(o.uv0.xy, 0, 0));
+ #else
+ float bulgeMask = 1.0;
+ #endif
+
+ depth = Linear01Depth(depth);
+
+ float intersect = 0;
+ if (depth != 1)
+ {
+ float diff = distance(depth, Linear01Depth(o.pos.z / o.pos.w));
+ if(diff > 0)
+ {
+ intersect = 1 - smoothstep(0, _ProjectionParams.w * _BuldgeFadeLength, diff);
+ }
+ }
+ float4 offset = intersect * _BuldgeHeight * float4(o.normal, 0);
+
+ offset = IsInMirror() ? 0: offset;
+ offset *= bulgeMask;
+
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos) + offset;
+ o.localPos = mul(unity_WorldToObject, o.worldPos);
+ o.pos = UnityObjectToClipPos(o.localPos);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBulge.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBulge.cginc.meta
new file mode 100644
index 00000000..bf1b19f9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiBulge.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c49023d4328abbe4dbce068a8f1ded2d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiClearCoat.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiClearCoat.cginc
new file mode 100644
index 00000000..23cde6cd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiClearCoat.cginc
@@ -0,0 +1,213 @@
+#ifndef POI_CLEARCOAT
+#define POI_CLEARCOAT
+
+float _Clearcoat;
+float _ClearcoatGlossiness;
+float _ClearcoatAnisotropy;
+float _ClearcoatForceFallback;
+float _ClearcoatEnableReflections;
+float _ClearcoatEnableSpecular;
+float _ClearcoatInvertSmoothness;
+#if defined(PROP_CLEARCOATMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_ClearcoatMap);
+#endif
+
+samplerCUBE _ClearcoatFallback;
+
+bool clearcoatDoesReflectionProbeExist()
+{
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiCam.reflectionDir, UNITY_SPECCUBE_LOD_STEPS);
+ bool probeExists = !(unity_SpecCube0_HDR.a == 0 && envSample.a == 0);
+ return probeExists && !_ClearcoatForceFallback;
+}
+
+float3 clearcoatF_Schlick(float u, float3 f0)
+{
+ return f0 + (1.0 - f0) * pow(1.0 - u, 5.0);
+}
+
+float4 getClearcoatSmoothness(float4 clearcoatMap)
+{
+ float roughness = 1 - (_ClearcoatGlossiness * clearcoatMap.a);
+ roughness = clamp(roughness, 0.0045, 1.0);
+ roughness = roughness * roughness;
+
+ float reflectivity = _Clearcoat * clearcoatMap.r;
+ return float4(reflectivity, 0, 0, roughness);
+}
+
+float getGeometricClearCoatSpecularAA(float3 normal)
+{
+ float3 vNormalWsDdx = ddx(normal.xyz);
+ float3 vNormalWsDdy = ddy(normal.xyz);
+ float flGeometricRoughnessFactor = pow(saturate(max(dot(vNormalWsDdx.xyz, vNormalWsDdx.xyz), dot(vNormalWsDdy.xyz, vNormalWsDdy.xyz))), 0.333);
+ return max(0, flGeometricRoughnessFactor);
+}
+
+float3 getClearcoatAnisotropicReflectionVector(float3 viewDir, float3 bitangent, float3 tangent, float3 normal, float roughness, float anisotropy)
+{
+ //_Anisotropy = lerp(-0.2, 0.2, sin(_Time.y / 20)); //This is pretty fun
+ float3 anisotropicDirection = anisotropy >= 0.0 ? bitangent: tangent;
+ float3 anisotropicTangent = cross(anisotropicDirection, viewDir);
+ float3 anisotropicNormal = cross(anisotropicTangent, anisotropicDirection);
+ float bendFactor = abs(anisotropy) * saturate(5.0 * roughness);
+ float3 bentNormal = normalize(lerp(normal, anisotropicNormal, bendFactor));
+ return reflect(-viewDir, bentNormal);
+}
+
+float D_GGXClearcoat(float NoH, float roughness)
+{
+ float a2 = roughness * roughness;
+ float f = (NoH * a2 - NoH) * NoH + 1.0;
+ return a2 / (UNITY_PI * f * f);
+}
+
+float D_GGXClearcoat_Anisotropic(float NoH, const float3 h, const float3 t, const float3 b, float at, float ab)
+{
+ float ToH = dot(t, h);
+ float BoH = dot(b, h);
+ float a2 = at * ab;
+ float3 v = float3(ab * ToH, at * BoH, a2 * NoH);
+ float v2 = dot(v, v);
+ float w2 = a2 / v2;
+ return a2 * w2 * w2 * (1.0 / UNITY_PI);
+}
+
+float V_SmithGGXClearcoatCorrelated(float NoV, float NoL, float a)
+{
+ float a2 = a * a;
+ float GGXL = NoV * sqrt((-NoL * a2 + NoL) * NoL + a2);
+ float GGXV = NoL * sqrt((-NoV * a2 + NoV) * NoV + a2);
+ return 0.5 / (GGXV + GGXL);
+}
+
+float3 getClearcoatDirectSpecular(float roughness, float ndh, float vdn, float ndl, float ldh, float3 f0, float3 halfVector, float3 tangent, float3 bitangent, float anisotropy)
+{
+ #if !defined(LIGHTMAP_ON)
+ float rough = max(roughness * roughness, 0.0045);
+ float Dn = D_GGXClearcoat(ndh, rough);
+ float3 F = clearcoatF_Schlick(ldh, f0);
+ float V = V_SmithGGXClearcoatCorrelated(vdn, ndl, rough);
+ float3 directSpecularNonAniso = max(0, (Dn * V) * F);
+
+ anisotropy *= saturate(5.0 * roughness);
+ float at = max(rough * (1.0 + anisotropy), 0.001);
+ float ab = max(rough * (1.0 - anisotropy), 0.001);
+ float D = D_GGXClearcoat_Anisotropic(ndh, halfVector, tangent, bitangent, at, ab);
+ float3 directSpecularAniso = max(0, (D * V) * F);
+
+ return lerp(directSpecularNonAniso, directSpecularAniso, saturate(abs(_ClearcoatAnisotropy * 100))) * 3; // * 100 to prevent blending, blend because otherwise tangents are fucked on lightmapped object
+ #else
+ return 0;
+ #endif
+}
+
+float3 getClearCoatBoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax)
+{
+ // #if defined(UNITY_SPECCUBE_BOX_PROJECTION) // For some reason this doesn't work?
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax: boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ // #endif
+ return direction;
+}
+
+float3 getClearcoatIndirectSpecular(float metallic, float roughness, float3 reflDir, float3 worldPos, float3 lightmap, float3 normal)
+{
+ float3 spec = float3(0, 0, 0);
+ #if defined(UNITY_PASS_FORWARDBASE)
+ float3 indirectSpecular;
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = roughness;
+ envData.reflUVW = getClearCoatBoxProjection(
+ reflDir, 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);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ envData.reflUVW = getClearCoatBoxProjection(
+ reflDir, worldPos,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz
+ );
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube0_HDR, envData);
+ indirectSpecular = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ indirectSpecular = probe0;
+ }
+
+ if (!clearcoatDoesReflectionProbeExist())
+ {
+ indirectSpecular = texCUBElod(_ClearcoatFallback, float4(envData.reflUVW, roughness * UNITY_SPECCUBE_LOD_STEPS)).rgb * poiLight.finalLighting;
+ }
+
+ float horizon = min(1 + dot(reflDir, normal), 1);
+ indirectSpecular *= horizon * horizon;
+
+ spec = indirectSpecular;
+ #if defined(LIGHTMAP_ON)
+ float specMultiplier = max(0, lerp(1, pow(length(lightmap), _SpecLMOcclusionAdjust), _SpecularLMOcclusion));
+ spec *= specMultiplier;
+ #endif
+ #endif
+ return spec;
+}
+
+void calculateAndApplyClearCoat(inout float4 finalColor)
+{
+ #if defined(PROP_CLEARCOATMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clearCoatMap = POI2D_SAMPLER_PAN(_ClearcoatMap, _MainTex, poiMesh.uv[_ClearcoatMapUV], _ClearcoatMapPan);
+ #else
+ float4 clearCoatMap = 1;
+ #endif
+
+ float4 clearcoatReflectivitySmoothness = getClearcoatSmoothness(clearCoatMap);
+ float clearcoatReflectivity = clearcoatReflectivitySmoothness.r;
+ float clearcoatRoughness = clearcoatReflectivitySmoothness.a;
+ UNITY_BRANCH
+ if (_ClearcoatInvertSmoothness)
+ {
+ clearcoatRoughness = 1 - clearcoatRoughness;
+ }
+ float3 creflViewDir = getClearcoatAnisotropicReflectionVector(poiCam.viewDir, poiMesh.binormal, poiMesh.tangent.xyz, poiMesh.normals[0], clearcoatRoughness, _ClearcoatAnisotropy);
+ float cndl = saturate(dot(poiLight.direction, poiMesh.normals[0]));
+ float cvdn = abs(dot(poiCam.viewDir, poiMesh.normals[0]));
+ float cndh = saturate(dot(poiMesh.normals[0], poiLight.halfDir));
+
+ float3 clearcoatf0 = 0.16 * clearcoatReflectivity * clearcoatReflectivity;
+ float3 clearcoatFresnel = clearcoatF_Schlick(cvdn, clearcoatf0);
+
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ float attenuation = poiLight.rampedLightMap;
+ #endif
+ #ifdef FORWARD_ADD_PASS
+ float attenuation = saturate(poiLight.nDotL);
+ #endif
+
+ float3 vDirectSpecular = 0;
+ #ifdef VERTEXLIGHT_ON
+ for (int index = 0; index < 4; index++)
+ {
+ float vcndh = saturate(dot(poiMesh.normals[0], poiLight.vHalfDir[index]));
+ float vcndl = saturate(dot(poiLight.vDirection[index], poiMesh.normals[0]));
+ float3 v0directSpecular = getClearcoatDirectSpecular(clearcoatRoughness, vcndh, max(cvdn, 0.000001), vcndl, saturate(poiLight.vDotLH[index]), clearcoatf0, poiLight.halfDir, poiMesh.tangent, poiMesh.binormal, _ClearcoatAnisotropy) * poiLight.vAttenuation * vcndl * poiLight.vColor[index];
+ vDirectSpecular += v0directSpecular;
+ }
+ #endif
+
+ float3 clearcoatDirectSpecular = getClearcoatDirectSpecular(clearcoatRoughness, cndh, max(cvdn, 0.000001), attenuation, saturate(poiLight.lDotH), clearcoatf0, poiLight.halfDir, poiMesh.tangent, poiMesh.binormal, _ClearcoatAnisotropy) * poiLight.attenuation * attenuation * poiLight.color;
+ float3 clearcoatIndirectSpecular = getClearcoatIndirectSpecular(0, clearcoatRoughness, creflViewDir, poiMesh.worldPos, finalColor, poiMesh.normals[0]);
+ float3 clearcoat = ((clearcoatDirectSpecular + vDirectSpecular) * clearCoatMap.g * _ClearcoatEnableSpecular + clearcoatIndirectSpecular * clearCoatMap.b * _ClearcoatEnableReflections) * clearcoatReflectivity * clearcoatFresnel;
+ finalColor.rgb += clearcoat;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiClearCoat.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiClearCoat.cginc.meta
new file mode 100644
index 00000000..895de4d7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiClearCoat.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 05e2de0df0c3a8147a1f7989db8ebd19
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiData.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiData.cginc
new file mode 100644
index 00000000..816c7a7c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiData.cginc
@@ -0,0 +1,260 @@
+#ifndef POI_DATA
+#define POI_DATA
+
+float _ParallaxBias;
+float _LightingAdditiveLimitIntensity;
+float _LightingAdditiveMaxIntensity;
+POI_TEXTURE_NOSAMPLER(_BumpMap);
+#ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DetailMask);
+ #endif
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DetailNormalMap);
+ #endif
+ float _DetailNormalMapScale;
+#endif
+float _BumpScale;
+
+void calculateAttenuation(v2f i)
+{
+ #ifdef FORWARD_ADD_PASS
+ #if defined(POINT) || defined(SPOT)
+ POI_LIGHT_ATTENUATION(attenuation, shadow, i, i.worldPos.xyz)
+ poiLight.additiveShadow = shadow;
+ #else
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz)
+ poiLight.additiveShadow == 0;
+ #endif
+ #else
+ UNITY_LIGHT_ATTENUATION(attenuation, i, i.worldPos.xyz)
+ // fix for rare bug where light atten is 0 when there is no directional light in the scene
+ #ifdef FORWARD_BASE_PASS
+ if (all(_LightColor0.rgb == 0.0))
+ {
+ attenuation = 1.0;
+ }
+ #endif
+ #endif
+ poiLight.attenuation = attenuation;
+}
+
+void calculateVertexLightingData(in v2f i)
+{
+ #ifdef VERTEXLIGHT_ON
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vDotNL = max(0, poiLight.vDotNL * corr);
+ poiLight.vAttenuationDotNL = poiLight.vAttenuation * poiLight.vDotNL;
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ UNITY_BRANCH
+ if (_LightingAdditiveLimitIntensity == 1)
+ {
+ float intensity = max(0.001, (0.299 * poiLight.vColor[index].r + 0.587 * poiLight.vColor[index].g + 0.114 * poiLight.vColor[index].b));
+ poiLight.vColor[index] = min(poiLight.vColor[index], poiLight.vColor[index] / (intensity / _LightingAdditiveMaxIntensity));
+ }
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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] = saturate(dot(poiMesh.normals[1], poiLight.vHalfDir[index]));
+ }
+ #endif
+}
+
+void calculateLightingData(in v2f i)
+{
+ poiLight.occlusion = 1;
+ #ifdef FORWARD_BASE_PASS
+ //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ float3 magic = max(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0);
+ float3 normalLight = _LightColor0.rgb;
+ poiLight.color = magic + normalLight;
+ #else
+ #ifdef FORWARD_ADD_PASS
+ poiLight.color = _LightColor0.rgb;
+
+ UNITY_BRANCH
+ if (_LightingAdditiveLimitIntensity == 1)
+ {
+ float additiveLightIntensity = max(0.001, (0.299 * poiLight.color.r + 0.587 * poiLight.color.g + 0.114 * poiLight.color.b));
+ poiLight.color = min(poiLight.color, poiLight.color / (additiveLightIntensity / _LightingAdditiveMaxIntensity));
+ }
+ #endif
+ #endif
+
+ #ifdef FORWARD_BASE_PASS
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ #else
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ #endif
+ #endif
+
+ poiLight.halfDir = normalize(poiLight.direction + poiCam.viewDir);
+
+ poiLight.dotNH = saturate(dot(poiMesh.normals[1], poiLight.halfDir));
+ poiLight.dotLH = saturate(dot(poiLight.direction, poiLight.halfDir));
+
+ poiLight.nDotV = dot(poiMesh.normals[1], poiCam.viewDir);
+ poiLight.N0DotV = dot(poiMesh.normals[0], poiCam.viewDir);
+ poiLight.nDotL = dot(poiMesh.normals[1], poiLight.direction);
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+}
+
+void initPoiMods()
+{
+ poiMods.audioLink = float4(0, 0, 0, 0);
+ poiMods.globalMasks = float4(0, 0, 0, 0);
+ #ifdef POI_AUDIOLINK
+ initAudioBands();
+ #endif
+}
+
+void InitializeMeshData(inout v2f i, uint facing)
+{
+ poiMesh.isFrontFace = facing;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.binormal.rgb = i.binormal;
+ poiMesh.tangent = i.tangent;
+
+ #ifndef OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.barycentricCoordinates = i.barycentricCoordinates;
+ poiMesh.uv[0] = i.uv0.xy;
+ poiMesh.uv[1] = i.uv0.zw;
+ poiMesh.uv[2] = i.uv1.xy;
+ poiMesh.uv[3] = i.uv1.zw;
+
+ initPoiMods();
+
+ #ifdef POI_UV_DISTORTION
+ poiMesh.uv[4] = calculateDistortionUV(i.uv0.xy);
+ #else
+ poiMesh.uv[4] = poiMesh.uv[0];
+ #endif
+
+ poiMesh.vertexColor = i.vertexColor;
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.modelPos = i.modelPos;
+
+ #ifdef FUR
+ poiMesh.furAlpha = i.furAlpha;
+ #endif
+}
+
+void initializeCamera(v2f i)
+{
+ poiCam.viewDir = normalize(_WorldSpaceCameraPos - i.worldPos.xyz);
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.clipPos = i.pos;
+ #if defined(GRAIN)
+ poiCam.worldDirection = i.worldDirection;
+ #endif
+
+ poiCam.tangentViewDir = normalize(i.tangentViewDir);
+ poiCam.decalTangentViewDir = poiCam.tangentViewDir;
+ poiCam.tangentViewDir.xy /= (poiCam.tangentViewDir.z + _ParallaxBias);
+}
+
+void calculateTangentData()
+{
+ poiTData.tangentTransform = float3x3(poiMesh.tangent.xyz, poiMesh.binormal, poiMesh.normals[0]);
+ poiTData.tangentToWorld = transpose(float3x3(poiMesh.tangent.xyz, poiMesh.binormal, poiMesh.normals[0]));
+}
+
+void CalculateReflectionData()
+{
+ #if defined(_METALLICGLOSSMAP) || defined(_COLORCOLOR_ON)
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ #endif
+}
+
+void calculateNormals(inout half3 detailMask)
+{
+ half3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiMesh.uv[_BumpMapUV], _BumpMapPan), _BumpScale);
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiMesh.uv[_DetailMaskUV], _DetailMaskPan).rgb;
+ #else
+ detailMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DetailNormalMapScale > 0)
+ {
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiMesh.uv[_DetailNormalMapUV], _DetailNormalMapPan), _DetailNormalMapScale * detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(mainNormal, detailNormal);
+ #else
+ poiMesh.tangentSpaceNormal = mainNormal;
+ #endif
+ }
+ else
+ {
+ poiMesh.tangentSpaceNormal = mainNormal;
+ }
+ #else
+ poiMesh.tangentSpaceNormal = mainNormal;
+ #endif
+
+ #ifdef POI_RGBMASK
+ calculateRGBNormals(poiMesh.tangentSpaceNormal);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ poiCam.viewDotNormal = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiData.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiData.cginc.meta
new file mode 100644
index 00000000..3d82995e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiData.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 221d9e3fa8c8639449704bdb192dbc4f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDebug.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDebug.cginc
new file mode 100644
index 00000000..961b5fb7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDebug.cginc
@@ -0,0 +1,107 @@
+#ifndef POI_DEBUG
+ #define POI_DEBUG
+
+ float _DebugEnabled;
+ float _DebugMeshData;
+ float _DebugLightingData;
+ float _DebugCameraData;
+
+ void displayDebugInfo(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if (_DebugEnabled != 0)
+ {
+ //Mesh Data
+ if (_DebugMeshData == 1)
+ {
+ finalColor.rgb = poiMesh.normals[0];
+ return;
+ }
+ else if(_DebugMeshData == 2)
+ {
+ finalColor.rgb = poiMesh.normals[1];
+ return;
+ }
+ else if(_DebugMeshData == 3)
+ {
+ finalColor.rgb = poiMesh.tangent;
+ return;
+ }
+ else if(_DebugMeshData == 4)
+ {
+ finalColor.rgb = poiMesh.binormal;
+ return;
+ }
+ else if(_DebugMeshData == 5)
+ {
+ finalColor.rgb = poiMesh.localPos;
+ return;
+ }
+
+ #ifdef POI_LIGHTING
+ if(_DebugLightingData == 1)
+ {
+ finalColor.rgb = poiLight.attenuation;
+ return;
+ }
+ else if(_DebugLightingData == 2)
+ {
+ finalColor.rgb = poiLight.directLighting;
+ return;
+ }
+ else if(_DebugLightingData == 3)
+ {
+ finalColor.rgb = poiLight.indirectLighting;
+ return;
+ }
+ else if(_DebugLightingData == 4)
+ {
+ finalColor.rgb = poiLight.lightMap;
+ return;
+ }
+ else if(_DebugLightingData == 5)
+ {
+ finalColor.rgb = poiLight.rampedLightMap;
+ return;
+ }
+ else if(_DebugLightingData == 6)
+ {
+ finalColor.rgb = poiLight.finalLighting;
+ return;
+ }
+ else if(_DebugLightingData == 7)
+ {
+ finalColor.rgb = poiLight.nDotL;
+ return;
+ }
+ #endif
+
+ if(_DebugCameraData == 1)
+ {
+ finalColor.rgb = poiCam.viewDir;
+ return;
+ }
+ else if(_DebugCameraData == 2)
+ {
+ finalColor.rgb = poiCam.tangentViewDir;
+ return;
+ }
+ else if(_DebugCameraData == 3)
+ {
+ finalColor.rgb = poiCam.forwardDir;
+ return;
+ }
+ else if(_DebugCameraData == 4)
+ {
+ finalColor.rgb = poiCam.worldPos;
+ return;
+ }
+ else if(_DebugCameraData == 5)
+ {
+ finalColor.rgb = poiCam.viewDotNormal;
+ return;
+ }
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDebug.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDebug.cginc.meta
new file mode 100644
index 00000000..40d0b923
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDebug.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1cc16395659ad2b4b886b2caaeb83829
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDecal.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDecal.cginc
new file mode 100644
index 00000000..5e1b64ef
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDecal.cginc
@@ -0,0 +1,331 @@
+#ifndef POI_DECAL
+#define POI_DECAL
+
+
+#if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalMask);
+#endif
+
+#if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalTexture);
+#else
+ float2 _DecalTextureUV;
+#endif
+float4 _DecalColor;
+fixed _DecalTiled;
+float _DecalBlendType;
+half _DecalRotation;
+half2 _DecalScale;
+half2 _DecalPosition;
+half _DecalRotationSpeed;
+float _DecalEmissionStrength;
+float _DecalBlendAlpha;
+float _DecalHueShiftEnabled;
+float _DecalHueShift;
+float _DecalHueShiftSpeed;
+
+// Audio Link
+half _AudioLinkDecal0ScaleBand;
+float4 _AudioLinkDecal0Scale;
+half _AudioLinkDecal0RotationBand;
+float2 _AudioLinkDecal0Rotation;
+half _AudioLinkDecal0AlphaBand;
+float2 _AudioLinkDecal0Alpha;
+half _AudioLinkDecal0EmissionBand;
+float2 _AudioLinkDecal0Emission;
+
+half _AudioLinkDecal1ScaleBand;
+float4 _AudioLinkDecal1Scale;
+half _AudioLinkDecal1RotationBand;
+float2 _AudioLinkDecal1Rotation;
+half _AudioLinkDecal1AlphaBand;
+float2 _AudioLinkDecal1Alpha;
+half _AudioLinkDecal1EmissionBand;
+float2 _AudioLinkDecal1Emission;
+
+half _AudioLinkDecal2ScaleBand;
+float4 _AudioLinkDecal2Scale;
+half _AudioLinkDecal2RotationBand;
+float2 _AudioLinkDecal2Rotation;
+half _AudioLinkDecal2AlphaBand;
+float2 _AudioLinkDecal2Alpha;
+half _AudioLinkDecal2EmissionBand;
+float2 _AudioLinkDecal2Emission;
+
+half _AudioLinkDecal3ScaleBand;
+float4 _AudioLinkDecal3Scale;
+half _AudioLinkDecal3RotationBand;
+float2 _AudioLinkDecal3Rotation;
+half _AudioLinkDecal3AlphaBand;
+float2 _AudioLinkDecal3Alpha;
+half _AudioLinkDecal3EmissionBand;
+float2 _AudioLinkDecal3Emission;
+
+#ifdef GEOM_TYPE_BRANCH_DETAIL
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalTexture1);
+ #else
+ float2 _DecalTexture1UV;
+ #endif
+ float4 _DecalColor1;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+#endif
+
+#ifdef GEOM_TYPE_FROND
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalTexture2);
+ #else
+ float2 _DecalTexture2UV;
+ #endif
+ float4 _DecalColor2;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+#endif
+
+#ifdef DEPTH_OF_FIELD_COC_VIEW
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DecalTexture3);
+ #else
+ float2 _DecalTexture3UV;
+ #endif
+ float4 _DecalColor3;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+#endif
+
+// Parallax
+float _Decal0Depth;
+float _Decal1Depth;
+float _Decal2Depth;
+float _Decal3Depth;
+
+float2 calcParallax(float height)
+{
+ return((height * - 1) + 1) * (poiCam.decalTangentViewDir.xy / poiCam.decalTangentViewDir.z);
+}
+
+
+float2 decalUV(float uvNumber, float2 position, half rotation, half rotationSpeed, half2 scale, float depth)
+{
+ float2 uv = poiMesh.uv[uvNumber] + calcParallax(depth + 1);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position, scale / 2 + position, float2(0, 0), float2(1, 1));
+ return uv;
+}
+
+inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+{
+ UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+}
+
+inline float applyTilingClipping(float enabled, float2 uv)
+{
+ float ret = 1;
+ UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+}
+
+void applyDecals(inout float4 albedo, inout float3 decalEmission)
+{
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiMesh.uv[_DecalMaskUV], _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ decalScale = _DecalScale;
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ }
+ #endif
+ uv = decalUV(_DecalTextureUV, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _Decal0Depth);
+ decalColor = POI2D_SAMPLER_PAN(_DecalTexture, _MainTex, uv, _DecalTexturePan) * _DecalColor;
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _Decal0Depth);
+ decalColor = _DecalColor;
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask.r;
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ albedo.rgb = lerp(albedo.rgb, customBlend(albedo.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ decalEmission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ }
+ #endif
+ uv = decalUV(_DecalTexture1UV, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _Decal1Depth);
+ decalColor = POI2D_SAMPLER_PAN(_DecalTexture1, _MainTex, uv, _DecalTexture1Pan) * _DecalColor1;
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _Decal1Depth);
+ decalColor = _DecalColor1;
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask.g;
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ albedo.rgb = lerp(albedo.rgb, customBlend(albedo.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ decalEmission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ }
+ #endif
+ uv = decalUV(_DecalTexture2UV, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _Decal2Depth);
+ decalColor = POI2D_SAMPLER_PAN(_DecalTexture2, _MainTex, uv, _DecalTexture2Pan) * _DecalColor2;
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _Decal2Depth);
+ decalColor = _DecalColor2;
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask.b;
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ albedo.rgb = lerp(albedo.rgb, customBlend(albedo.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ decalEmission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ }
+ #endif
+ uv = decalUV(_DecalTexture3UV, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _Decal3Depth);
+ decalColor = POI2D_SAMPLER_PAN(_DecalTexture3, _MainTex, uv, _DecalTexture3Pan) * _DecalColor3;
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _Decal3Depth);
+ decalColor = _DecalColor3;
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask.a;
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ albedo.rgb = lerp(albedo.rgb, customBlend(albedo.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkTextureExists;
+ #endif
+
+ decalEmission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+
+ albedo = saturate(albedo);
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDecal.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDecal.cginc.meta
new file mode 100644
index 00000000..f49f4460
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDecal.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 664de60cb14b4194ba278cf1f8d8cec5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDefines.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDefines.cginc
new file mode 100644
index 00000000..0c789440
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDefines.cginc
@@ -0,0 +1,7 @@
+#ifndef POI_DEFINES
+ #define POI_DEFINES
+
+ #define DielectricSpec float4(0.04, 0.04, 0.04, 1.0 - 0.04)
+ #define pi float(3.14159265359)
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDefines.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDefines.cginc.meta
new file mode 100644
index 00000000..7d163c12
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDefines.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7c4268f3614d17d49ba4a6865bd104de
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDepthColor.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDepthColor.cginc
new file mode 100644
index 00000000..6e1f834d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDepthColor.cginc
@@ -0,0 +1,129 @@
+#ifndef POI_DEPTH_COLOR
+ #define POI_DEPTH_COLOR
+
+ float4 _DepthGlowColor;
+ float _DepthGlowEmission;
+ float _FadeLength;
+ float _DepthAlphaMin;
+ float _DepthAlphaMax;
+ float _DepthGradientTextureUV;
+ float _DepthGradientBlend;
+
+ #if defined(PROP_DEPTHGRADIENT) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DepthGradient);
+ #endif
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DepthMask);
+ #endif
+
+ /*
+ void applyDepthColor(inout float4 finalColor, inout float3 depthTouchEmission, inout float3 finalEmission, float4 worldDirection, float4 clipPos)
+ {
+ float3 touchEmission = 0;
+ if (!IsInMirror())
+ {
+ float fadeLength = _FadeLength;
+ fadeLength *= 0.01;
+ float depth = DecodeFloatRG(tex2Dproj(_CameraDepthTexture, worldDirection));
+ depth = Linear01Depth(depth);
+ if(depth != 1)
+ {
+ float diff = distance(depth, Linear01Depth(clipPos.z));
+ float intersect = 0;
+ if(diff > 0)
+ {
+ intersect = clamp(1 - smoothstep(0, _ProjectionParams.w * fadeLength, diff), 0, 1);
+ }
+ half4 depthGradient = UNITY_SAMPLE_TEX2D_SAMPLER(_DepthGradient, _MainTex, intersect);
+ half3 depthMask = UNITY_SAMPLE_TEX2D_SAMPLER(_DepthMask, _MainTex, poiMesh.uv[0]);
+ half3 depthColor = depthGradient.rgb * _DepthGlowColor.rgb;
+ finalColor.rgb = lerp(finalColor.rgb, depthColor, intersect * depthMask);
+ finalColor.a *= lerp(_DepthAlphaMax, _DepthAlphaMin, intersect);
+ touchEmission = depthColor * _DepthGlowEmission * intersect * depthMask;
+ }
+ }
+ depthTouchEmission = touchEmission;
+ }
+ */
+
+ inline float CorrectedLinearEyeDepth(float z, float B)
+ {
+ return 1.0 / (z / PM._34 + B);
+ }
+
+ void applyDepthColor(inout float4 finalColor, inout float3 depthTouchEmission, inout float3 finalEmission, in float4 worldDirection)
+ {
+ float3 touchEmission = 0;
+ float fadeLength = _FadeLength;
+ fadeLength *= 0.01;
+
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.xy * 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);
+ float intersect = 0;
+ intersect = clamp(1 - smoothstep(0, fadeLength, diff), 0, 1);
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ half3 depthMask = POI2D_SAMPLER_PAN(_DepthMask, _MainTex, poiMesh.uv[_DepthMaskUV], _DepthMaskPan);
+ #else
+ half3 depthMask = 1;
+ #endif
+
+ half4 depthGradient = 0;
+ half3 depthColor = 0;
+
+ UNITY_BRANCH
+ if (_DepthGradientTextureUV == 0)
+ {
+ #if defined(PROP_DEPTHGRADIENT) || !defined(OPTIMIZER_ENABLED)
+ depthGradient = POI2D_SAMPLER_PAN(_DepthGradient, _MainTex, float2(intersect, intersect), _DepthGradientPan);
+ #else
+ depthGradient = 1;
+ #endif
+ depthColor = depthGradient.rgb * _DepthGlowColor.rgb;
+ }
+ else
+ {
+ #if defined(PROP_DEPTHGRADIENT) || !defined(OPTIMIZER_ENABLED)
+ depthGradient = POI2D_SAMPLER_PAN(_DepthGradient, _MainTex, poiMesh.uv[_DepthGradientUV], _DepthGradientPan);
+ #else
+ depthGradient = 1;
+ #endif
+ depthColor = depthGradient.rgb * _DepthGlowColor.rgb * intersect;
+ }
+
+ UNITY_BRANCH
+ if(_DepthGradientBlend == 0) // rpelace
+ {
+ finalColor.rgb = lerp(finalColor.rgb, depthColor, intersect * depthMask);
+ }
+ else if (_DepthGradientBlend == 1) // add
+ {
+ finalColor.rgb += depthColor * intersect * depthMask;
+ }
+ else if (_DepthGradientBlend == 2) // multiply
+ {
+ finalColor.rgb *= lerp(1, depthColor, intersect * depthMask);
+ }
+ finalColor.a *= lerp(_DepthAlphaMax, _DepthAlphaMin, intersect * depthMask);
+ touchEmission = depthColor * _DepthGlowEmission * intersect * depthMask;
+
+ depthTouchEmission = touchEmission;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDepthColor.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDepthColor.cginc.meta
new file mode 100644
index 00000000..72f55fc6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDepthColor.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 051133829be575149906a0cbe6572012
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDissolve.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDissolve.cginc
new file mode 100644
index 00000000..ee46ba87
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDissolve.cginc
@@ -0,0 +1,237 @@
+#ifndef POI_DISSOLVE
+#define POI_DISSOLVE
+
+float _DissolveType;
+float _DissolveEdgeWidth;
+float4 _DissolveEdgeColor;
+sampler2D _DissolveEdgeGradient; float4 _DissolveEdgeGradient_ST;
+float _DissolveEdgeEmission;
+float4 _DissolveTextureColor;
+
+#if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DissolveToTexture);
+#endif
+
+#if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DissolveNoiseTexture);
+#endif
+
+#if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DissolveDetailNoise);
+#endif
+
+#if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DissolveMask);
+#endif
+
+float _DissolveMaskInvert;
+float _DissolveAlpha;
+float _ContinuousDissolve;
+float _DissolveDetailStrength;
+float _DissolveEdgeHardness;
+float _DissolveInvertNoise;
+float _DissolveInvertDetailNoise;
+float _DissolveToEmissionStrength;
+
+// Point to Point
+float _DissolveP2PWorldLocal;
+float _DissolveP2PEdgeLength;
+float4 _DissolveStartPoint;
+float4 _DissolveEndPoint;
+
+// World Dissolve
+float _DissolveWorldShape;
+float4 _DissolveShapePosition;
+float4 _DissolveShapeRotation;
+float _DissolveShapeScale;
+float _DissolveInvertShape;
+float _DissolveShapeEdgeLength;
+
+float _DissolveAlpha0;
+float _DissolveAlpha1;
+float _DissolveAlpha2;
+float _DissolveAlpha3;
+float _DissolveAlpha4;
+float _DissolveAlpha5;
+float _DissolveAlpha6;
+float _DissolveAlpha7;
+float _DissolveAlpha8;
+float _DissolveAlpha9;
+// Masking
+float _DissolveEmissionSide;
+float _DissolveEmission1Side;
+float _DissolveUseVertexColors;
+
+// Audio Link
+#ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+#endif
+
+float4 edgeColor;
+float edgeAlpha;
+float dissolveAlpha;
+float4 dissolveToTexture;
+
+float _DissolveHueShiftEnabled;
+float _DissolveHueShiftSpeed;
+float _DissolveHueShift;
+float _DissolveEdgeHueShiftEnabled;
+float _DissolveEdgeHueShiftSpeed;
+float _DissolveEdgeHueShift;
+void calculateDissolve(inout float4 albedo, inout float3 dissolveEmission)
+{
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiMesh.uv[_DissolveMaskUV], _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #if defined(PROP_DISSOLVETOTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ dissolveToTexture = POI2D_SAMPLER_PAN(_DissolveToTexture, _MainTex, poiMesh.uv[_DissolveToTextureUV], _DissolveToTexturePan) * _DissolveTextureColor;
+ #else
+ dissolveToTexture = _DissolveTextureColor;
+ #endif
+
+ #if defined(PROP_DISSOLVENOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveNoiseTexture = POI2D_SAMPLER_PAN(_DissolveNoiseTexture, _MainTex, poiMesh.uv[_DissolveNoiseTextureUV], _DissolveNoiseTexturePan).r;
+ #else
+ float dissolveNoiseTexture = 1;
+ #endif
+
+ float da = _DissolveAlpha
+ + _DissolveAlpha0
+ + _DissolveAlpha1
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkTextureExists)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.y * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ UNITY_BRANCH
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(noise, da + _DissolveEdgeWidth, da, 0, 1) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb: poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #endif
+ albedo = lerp(albedo, dissolveToTexture, dissolveAlpha * .999999);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, TRANSFORM_TEX(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient)) * _DissolveEdgeColor;
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #endif
+ albedo.rgb = lerp(albedo.rgb, edgeColor.rgb, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha));
+ }
+
+ dissolveEmission = lerp(0, dissolveToTexture * _DissolveToEmissionStrength, dissolveAlpha) + lerp(0, edgeColor.rgb * _DissolveEdgeEmission, smoothstep(0, 1 - _DissolveEdgeHardness * .99999999999, edgeAlpha));
+}
+
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDissolve.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDissolve.cginc.meta
new file mode 100644
index 00000000..a4fbdf2d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDissolve.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e737055de48f98a4587f09a286ede08f
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDithering.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDithering.cginc
new file mode 100644
index 00000000..1540b5eb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDithering.cginc
@@ -0,0 +1,34 @@
+#ifndef POI_DITHERING
+ #define POI_DITHERING
+ fixed _DitheringEnabled;
+ fixed _DitherGradient;
+
+ half calcDither(half2 grabPos)
+ {
+ half dither = Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ return dither;
+ }
+
+ #ifndef POI_SHADOW
+ void applyDithering(inout float4 finalColor)
+ {
+ UNITY_BRANCH
+ if (_DitheringEnabled)
+ {
+ half dither = calcDither(poiCam.screenUV.xy);
+ finalColor.a = finalColor.a - (dither * (1 - finalColor.a) * _DitherGradient);
+ }
+ }
+ #else
+ void applyShadowDithering(inout float alpha, float2 screenUV)
+ {
+ UNITY_BRANCH
+ if(_DitheringEnabled)
+ {
+ half dither = calcDither(screenUV);
+ alpha = alpha - (dither * (1 - alpha) * _DitherGradient);
+ }
+ }
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDithering.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDithering.cginc.meta
new file mode 100644
index 00000000..da58503e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiDithering.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 07d19319226672d40891a9cf8095bb1d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEmission.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEmission.cginc
new file mode 100644
index 00000000..9beafd3c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEmission.cginc
@@ -0,0 +1,341 @@
+#ifndef POI_EMISSION
+#define POI_EMISSION
+
+float4 _EmissionColor;
+#if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_EmissionMap);
+#endif
+#if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_EmissionMask);
+#endif
+#if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve); float4 _EmissionScrollingCurve_ST;
+#endif
+float _EmissionBaseColorAsMap;
+float _EmissionStrength;
+float _EnableEmission;
+float _EmissionHueShift;
+float4 _EmissiveScroll_Direction;
+float _EmissiveScroll_Width;
+float _EmissiveScroll_Velocity;
+float _EmissiveScroll_Interval;
+float _EmissionBlinkingEnabled;
+float _EmissiveBlink_Min;
+float _EmissiveBlink_Max;
+float _EmissiveBlink_Velocity;
+float _ScrollingEmission;
+float _EnableGITDEmission;
+float _GITDEMinEmissionMultiplier;
+float _GITDEMaxEmissionMultiplier;
+float _GITDEMinLight;
+float _GITDEMaxLight;
+float _GITDEWorldOrMesh;
+float _EmissionCenterOutEnabled;
+float _EmissionCenterOutSpeed;
+float _EmissionHueShiftEnabled;
+float _EmissionBlinkingOffset;
+float _EmissionScrollingOffset;
+float _EmissionHueShiftSpeed;
+float _EmissionHueShiftSpeed1;
+
+float4 _EmissionColor1;
+#ifdef EFFECT_HUE_VARIATION
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_EmissionMap1);
+ #endif
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_EmissionMask1);
+ #endif
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_EmissionScrollingCurve1); float4 _EmissionScrollingCurve1_ST;
+ #endif
+#endif
+float _EmissionBaseColorAsMap1;
+float _EmissionStrength1;
+float _EnableEmission1;
+float _EmissionHueShift1;
+float4 _EmissiveScroll_Direction1;
+float _EmissiveScroll_Width1;
+float _EmissiveScroll_Velocity1;
+float _EmissiveScroll_Interval1;
+float _EmissionBlinkingEnabled1;
+float _EmissiveBlink_Min1;
+float _EmissiveBlink_Max1;
+float _EmissiveBlink_Velocity1;
+float _ScrollingEmission1;
+float _EnableGITDEmission1;
+float _GITDEMinEmissionMultiplier1;
+float _GITDEMaxEmissionMultiplier1;
+float _GITDEMinLight1;
+float _GITDEMaxLight1;
+float _GITDEWorldOrMesh1;
+float _EmissionCenterOutEnabled1;
+float _EmissionCenterOutSpeed1;
+float _EmissionHueShiftEnabled1;
+float _EmissionBlinkingOffset1;
+float _EmissionScrollingOffset1;
+
+float _EmissionReplace;
+
+float _EmissionScrollingVertexColor;
+float _EmissionScrollingVertexColor1;
+
+float _EmissionScrollingUseCurve;
+float _EmissionScrollingUseCurve1;
+
+#ifdef POI_AUDIOLINK
+ half _EnableEmissionStrengthAudioLink;
+ half _AudioLinkEmissionStrengthBand;
+ half _EnableEmissionCenterOutAudioLink;
+ half _AudioLinkEmissionCenterOutBand;
+ float2 _AudioLinkAddEmission;
+ half _AudioLinkAddEmissionBand;
+ float2 _EmissionCenterOutAddAudioLink;
+ half _AudioLinkEmissionCenterOutAddBand;
+
+ half _EnableEmission1StrengthAudioLink;
+ half _AudioLinkEmission1StrengthBand;
+ half _EnableEmission1CenterOutAudioLink;
+ half _AudioLinkEmission1CenterOutBand;
+ float2 _AudioLinkAddEmission1;
+ half _AudioLinkAddEmission1Band;
+ float2 _EmissionCenterOutAddAudioLink1;
+ half _AudioLinkEmission1CenterOutAddBand;
+
+ fixed _EmissionCenterOutAudioLinkWidth;
+ fixed _EmissionCenterOutAddAudioLinkwidth;
+ fixed _Emission1CenterOutAudioLinkWidth;
+ fixed _Emission1CenterOutAddAudioLinkwidth;
+#endif
+
+float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh)
+{
+ float glowInTheDarkMultiplier = 1;
+ UNITY_BRANCH
+ if (enabled)
+ {
+ #ifdef POI_LIGHTING
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb): calculateluminance(poiLight.directLighting.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ #endif
+ }
+ return glowInTheDarkMultiplier;
+}
+
+float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+{
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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;
+}
+
+float3 calculateEmissionNew(in float3 baseColor, inout float4 finalColor)
+{
+ // First Emission
+ float3 emission0 = 0;
+ float emissionStrength0 = _EmissionStrength;
+ float3 emissionColor0 = 0;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ UNITY_BRANCH
+ if (_EnableEmissionStrengthAudioLink)
+ {
+ emissionStrength0 *= poiMods.audioLink[_AudioLinkEmissionStrengthBand];
+ }
+ UNITY_BRANCH
+ if (_EnableEmissionCenterOutAudioLink)
+ {
+ emissionStrength0 *= getBandAtTime(_AudioLinkEmissionCenterOutBand, saturate(1 - poiLight.nDotV), _EmissionCenterOutAudioLinkWidth);
+ }
+ emissionStrength0 += lerp(_EmissionCenterOutAddAudioLink.x, _EmissionCenterOutAddAudioLink.y, getBandAtTime(_AudioLinkEmissionCenterOutAddBand, saturate(1 - poiLight.nDotV), _EmissionCenterOutAddAudioLinkwidth));
+ emissionStrength0 += lerp(_AudioLinkAddEmission.x, _AudioLinkAddEmission.y, poiMods.audioLink[_AudioLinkAddEmissionBand]);
+ emissionStrength0 = max(emissionStrength0, 0);
+ }
+ #endif
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiMesh.uv[_EmissionMapUV], _EmissionMapPan).rgb * lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ }
+ #else
+ emissionColor0 = lerp(1, baseColor, _EmissionBaseColorAsMap).rgb * _EmissionColor.rgb;
+ #endif
+
+ UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMaskUV], _EmissionMask) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = emissionStrength0 * emissionColor0;
+
+ #ifdef POI_DISSOLVE
+ UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ emission0 *= lerp(1 - dissolveAlpha, dissolveAlpha, _DissolveEmissionSide);
+ }
+ #endif
+
+ // Second Emission
+ float3 emission1 = 0;
+ float emissionStrength1 = 0;
+ float3 emissionColor1 = 0;
+
+ #ifdef EFFECT_HUE_VARIATION
+ emissionStrength1 = _EmissionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ UNITY_BRANCH
+ if (_EnableEmission1StrengthAudioLink)
+ {
+ emissionStrength1 *= poiMods.audioLink[_AudioLinkEmission1StrengthBand];
+ }
+ UNITY_BRANCH
+ if (_EnableEmission1CenterOutAudioLink)
+ {
+ emissionStrength1 *= getBandAtTime(_AudioLinkEmission1CenterOutBand, saturate(1 - poiLight.nDotV), _Emission1CenterOutAudioLinkWidth);
+ }
+ emissionStrength1 += lerp(_EmissionCenterOutAddAudioLink1.x, _EmissionCenterOutAddAudioLink1.y, getBandAtTime(_AudioLinkEmission1CenterOutAddBand, saturate(1 - poiLight.nDotV), _Emission1CenterOutAddAudioLinkwidth));
+ emissionStrength1 += lerp(_AudioLinkAddEmission1.x, _AudioLinkAddEmission1.y, poiMods.audioLink[_AudioLinkAddEmission1Band]);
+ emissionStrength1 = max(emissionStrength1, 0);
+ }
+ #endif
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiMesh.uv[_EmissionMap1UV], _EmissionMap1Pan) * lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;
+ }
+ #else
+ emissionColor1 = lerp(1, baseColor, _EmissionBaseColorAsMap1).rgb * _EmissionColor1.rgb;;
+ #endif
+ UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _EmissionHueShiftEnabled1);
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask1, _MainTex, TRANSFORM_TEX(poiMesh.uv[_EmissionMask1UV], _EmissionMask1) + _Time.x * _EmissionMask1Pan);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = emissionStrength1 * emissionColor1;
+
+ #ifdef POI_DISSOLVE
+ if (_DissolveEmission1Side != 2)
+ {
+ emission1 *= lerp(1 - dissolveAlpha, dissolveAlpha, _DissolveEmission1Side);
+ }
+ #endif
+ #endif
+ finalColor.rgb = lerp(finalColor.rgb, saturate(emissionColor0 + emissionColor1), saturate(emissionStrength0 + emissionStrength1) * _EmissionReplace * poiMax(emission0 + emission1));
+
+ return emission0 + emission1;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEmission.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEmission.cginc.meta
new file mode 100644
index 00000000..db647b30
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEmission.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: fb39e9f722d93614d8bb1b9b708f60e6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc
new file mode 100644
index 00000000..92ed124a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc
@@ -0,0 +1,48 @@
+#ifndef POI_ENVIRONMENTAL_RIM
+ #define POI_ENVIRONMENTAL_RIM
+
+ //enviro rim
+ float _EnableEnvironmentalRim;
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_RimEnviroMask);
+ #endif
+
+ float3 calculateEnvironmentalRimLighting(in float4 albedo)
+ {
+ float enviroRimAlpha = saturate(1 - smoothstep(min(_RimEnviroSharpness, _RimEnviroWidth), _RimEnviroWidth, poiCam.viewDotNormal));
+ _RimEnviroBlur *= 1.7 - 0.7 * _RimEnviroBlur;
+
+ float3 enviroRimColor = 0;
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ float4 reflectionData = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiMesh.normals[1], _RimEnviroBlur * UNITY_SPECCUBE_LOD_STEPS);
+ enviroRimColor = DecodeHDR(reflectionData, unity_SpecCube0_HDR);
+ }
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ half enviroMask = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #else
+ half enviroMask = 1;
+ #endif
+ return lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * albedo.rgb), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta
new file mode 100644
index 00000000..2fab05f3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiEnvironmentalRimLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a1c11292ccd8b1d41887e0f69e6695dd
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFlipbook.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFlipbook.cginc
new file mode 100644
index 00000000..f600ced0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFlipbook.cginc
@@ -0,0 +1,221 @@
+#ifndef POI_FLIPBOOK
+#define POI_FLIPBOOK
+
+#if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray); float4 _FlipbookTexArray_ST;
+#endif
+#if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_FlipbookMask);
+#endif
+
+float4 _FlipbookColor;
+float _FlipbookFPS;
+float _FlipbookTotalFrames;
+float4 _FlipbookScaleOffset;
+float _FlipbookTiled;
+float _FlipbookCurrentFrame;
+float _FlipbookEmissionStrength;
+float _FlipbookRotation;
+float _EnableFlipbook;
+float _FlipbookTexArrayUV;
+float _FlipbookAlphaControlsFinalAlpha;
+float _FlipbookRotationSpeed;
+float _FlipbookIntensityControlsAlpha;
+float _FlipbookColorReplaces;
+float2 _FlipbookTexArrayPan;
+
+// blending
+float _FlipbookReplace;
+float _FlipbookMultiply;
+float _FlipbookAdd;
+
+// anim
+float _FlipbookMovementType;
+float4 _FlipbookStartEndOffset;
+float _FlipbookMovementSpeed;
+
+// Crossfade
+float _FlipbookCrossfadeEnabled;
+float2 _FlipbookCrossfadeRange;
+
+float _FlipbookHueShiftEnabled;
+float _FlipbookHueShiftSpeed;
+float _FlipbookHueShift;
+// Global
+float4 flipBookPixel;
+float4 flipBookPixelMultiply;
+float flipBookMask;
+
+// Audio Link
+half _AudioLinkFlipbookScaleBand;
+half4 _AudioLinkFlipbookScale;
+half _AudioLinkFlipbookAlphaBand;
+half2 _AudioLinkFlipbookAlpha;
+half _AudioLinkFlipbookEmissionBand;
+half2 _AudioLinkFlipbookEmission;
+half _AudioLinkFlipbookFrameBand;
+half2 _AudioLinkFlipbookFrame;
+
+#ifndef POI_SHADOW
+
+ void applyFlipbook(inout float4 finalColor, inout float3 flipbookEmission)
+ {
+
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ flipBookMask = 1;
+ #endif
+ float4 flipbookScaleOffset = _FlipbookScaleOffset;
+
+ #ifdef POI_AUDIOLINK
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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);
+
+ float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(0, 0), float2(1, 1));
+
+ UNITY_BRANCH
+ if (_FlipbookTiled == 0)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ flipBookPixel = 0;
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ if (_FlipbookCurrentFrame < 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ #ifdef POI_AUDIOLINK
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = _FlipbookColor.rgb;
+ }
+ else
+ {
+ flipBookPixel.rgb *= _FlipbookColor.rgb;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ flipbookAlpha = saturate(lerp(_AudioLinkFlipbookAlpha.x, _AudioLinkFlipbookAlpha.y, poiMods.audioLink[_AudioLinkFlipbookAlphaBand]));
+ #endif
+
+ finalColor.rgb = lerp(finalColor.rgb, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ finalColor.rgb = finalColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ finalColor.rgb = finalColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ UNITY_BRANCH
+ if (_FlipbookAlphaControlsFinalAlpha)
+ {
+ finalColor.a = lerp(finalColor.a, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ flipbookEmissionStrength += max(lerp(_AudioLinkFlipbookEmission.x, _AudioLinkFlipbookEmission.y, poiMods.audioLink[_AudioLinkFlipbookEmissionBand]), 0);
+ #endif
+ flipbookEmission = lerp(0, flipBookPixel.rgb * flipbookEmissionStrength, flipBookPixel.a * _FlipbookColor.a * flipBookMask * flipbookAlpha);
+ }
+
+#else
+
+ float applyFlipbookAlphaToShadow(float2 uv)
+ {
+ UNITY_BRANCH
+ if (_FlipbookAlphaControlsFinalAlpha)
+ {
+ float flipbookShadowAlpha = 0;
+
+ float4 flipbookScaleOffset = _FlipbookScaleOffset;
+ flipbookScaleOffset.xy = 1 - flipbookScaleOffset.xy;
+ float theta = radians(_FlipbookRotation);
+
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ 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);
+
+ float2 newUV = remap(uv, float2(0, 0) + flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(1, 1) - flipbookScaleOffset.xy / 2 + flipbookScaleOffset.zw, float2(0, 0), float2(1, 1));
+
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ if (_FlipbookCurrentFrame < 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+
+ half4 flipbookColor = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipbookColor = lerp(flipbookColor, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ half4 flipbookColor = 1;
+ #endif
+
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipbookColor.a = poiMax(flipbookColor.rgb);
+ }
+
+ UNITY_BRANCH
+ if (_FlipbookTiled == 0)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ flipbookColor.a = 0;
+ }
+ }
+ return flipbookColor.a * _FlipbookColor.a;
+ }
+ return 1;
+ }
+
+#endif
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFlipbook.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFlipbook.cginc.meta
new file mode 100644
index 00000000..c3c259f1
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFlipbook.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 87a9dab4f8128cd41bf38bac18075b14
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFrag.cginc
new file mode 100644
index 00000000..a852d5f0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFrag.cginc
@@ -0,0 +1,422 @@
+#ifndef POIFRAG
+#define POIFRAG
+
+float _MainEmissionStrength;
+float _IgnoreFog;
+half _GIEmissionMultiplier;
+float _IridescenceTime;
+float _AlphaToMask;
+float _ForceOpaque;
+float _commentIfZero_EnableGrabpass;
+float _AlphaPremultiply;
+float2 _MainTexPan;
+float _MainTextureUV;
+float _LightingAdditiveEnable;
+
+// Post Processing
+float _PPLightingMultiplier;
+float _PPEmissionMultiplier;
+
+float4 frag(v2f i, uint facing: SV_IsFrontFace): SV_Target
+{
+ #ifdef FORWARD_ADD_PASS
+ #if !defined(POI_LIGHTING)
+ return 0;
+ #endif
+ UNITY_BRANCH
+ if (_LightingAdditiveEnable == 0)
+ {
+ return 0;
+ }
+ #endif
+ UNITY_SETUP_INSTANCE_ID(i);
+ // Color
+ float4 albedo = 1;
+ float4 finalColor = 1;
+
+ // Lighting
+ float bakedCubemap = 0; // Whether or not metallic should run before or after lighting multiplication
+ float3 finalSpecular0 = 0;
+ float3 finalSpecular1 = 0;
+ float3 finalSSS = 0;
+ fixed lightingAlpha = 1;
+ float3 finalEnvironmentalRim = 0;
+
+ // Emissions
+ float3 finalEmission = 0;
+ float3 finalLighting = 1;
+ float3 emissionLighting = 1;
+ float3 IridescenceEmission = 0;
+ float3 spawnInEmission = 0;
+ float3 voronoiEmission = 0;
+ float3 matcapEmission = 0;
+ float3 depthTouchEmission = 0;
+ float3 decalEmission = 0;
+ float3 glitterEmission = 0;
+ float3 panosphereEmission = 0;
+ float3 backFaceEmission = 0;
+ float3 dissolveEmission = 0;
+ float3 rimLightEmission = 0;
+ float3 flipbookEmission = 0;
+ float3 textOverlayEmission = 0;
+ float3 videoEmission = 0;
+ float3 pathEmission = 0;
+ /**********************************************************************
+ Initialize the base data that's needed everywhere else in the shader
+ **********************************************************************/
+ calculateAttenuation(i);
+ InitializeMeshData(i, facing);
+ initializeCamera(i);
+ calculateTangentData();
+
+
+ #ifdef POI_BLACKLIGHT
+ createBlackLightMask();
+ UNITY_BRANCH
+ if (_BlackLightMaskDebug)
+ {
+ return float4(blackLightMask.rgb, 1);
+ }
+ #endif
+
+ // This has to happen in the initializbecause it alters UV data globally
+ #ifdef POI_PARALLAX
+ calculateandApplyParallax();
+ #endif
+
+ // Basically every texture relies on the maintex sampler to function and that's why this is here.
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[_MainTextureUV], _MainTex) + _Time.x * _MainTexPan);
+ half3 detailMask = 1;
+ calculateNormals(detailMask);
+
+ //return float4(poiMesh.binormal.xyz, 1);
+ calculateVertexLightingData(i);
+ /**********************************************************************
+ Calculate Light Maps
+ **********************************************************************/
+ #ifdef POI_DATA
+ calculateLightingData(i);
+ #endif
+ #ifdef POI_LIGHTING
+ calculateBasePassLightMaps();
+ #endif
+
+ /**********************************************************************
+ Calculate Color Data
+ **********************************************************************/
+
+ initTextureData(albedo, mainTexture, backFaceEmission, dissolveEmission, detailMask);
+
+ #ifdef POI_PATHING
+ applyPathing(albedo, pathEmission);
+ #endif
+
+ #ifdef POI_DECAL
+ applyDecals(albedo, decalEmission);
+ #endif
+
+
+ #ifdef POI_IRIDESCENCE
+ UNITY_BRANCH
+ if (_IridescenceTime == 0)
+ {
+ applyIridescence(albedo, IridescenceEmission);
+ }
+ #endif
+
+ #ifdef POI_VORONOI
+ applyVoronoi(albedo, voronoiEmission);
+ #endif
+
+ #ifdef POI_MSDF
+ ApplyTextOverlayColor(albedo, textOverlayEmission);
+ #endif
+
+ #ifdef POI_ENVIRONMENTAL_RIM
+ finalEnvironmentalRim = calculateEnvironmentalRimLighting(albedo);
+ #endif
+
+ #if defined(POI_METAL) || defined(POI_CLEARCOAT)
+ CalculateReflectionData();
+ #endif
+
+ #ifdef POI_DATA
+ distanceFade(albedo);
+ #endif
+
+ #ifdef POI_RANDOM
+ albedo.a *= i.angleAlpha;
+ #endif
+
+ #ifdef MATCAP
+ applyMatcap(albedo, matcapEmission);
+ #endif
+
+ #ifdef PANOSPHERE
+ applyPanosphereColor(albedo, panosphereEmission);
+ #endif
+
+ #ifdef POI_FLIPBOOK
+ applyFlipbook(albedo, flipbookEmission);
+ #endif
+
+ #ifdef POI_GLITTER
+ applyGlitter(albedo, glitterEmission);
+ #endif
+
+ #ifdef POI_RIM
+ applyRimLighting(albedo, rimLightEmission);
+ #endif
+
+ #ifdef POI_DEPTH_COLOR
+ applyDepthColor(albedo, depthTouchEmission, finalEmission, i.worldDirection);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ UNITY_BRANCH
+ if (_IridescenceTime == 1)
+ {
+ applyIridescence(albedo, IridescenceEmission);
+ }
+ #endif
+
+ #ifdef POI_VIDEO
+ applyScreenEffect(albedo, videoEmission);
+ #endif
+
+ applySpawnIn(albedo, spawnInEmission, poiMesh.uv[0], poiMesh.localPos);
+
+ /**********************************************************************
+ Handle a few alpha options
+ **********************************************************************/
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaToMask == 0)
+ {
+ applyDithering(albedo);
+ }
+ }
+
+ albedo.a = max(_ForceOpaque, albedo.a);
+
+ UNITY_BRANCH
+ if (_Mode == 0)
+ {
+ albedo.a = 1;
+ }
+
+ UNITY_BRANCH
+ if (_Mode >= 1)
+ {
+ clip(albedo.a - _Cutoff);
+ }
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ albedo.rgb *= saturate(albedo.a + 0.0000000001);
+ }
+
+ /**********************************************************************
+ Lighting Time :)
+ **********************************************************************/
+
+ #ifdef POI_LIGHTING
+ finalLighting = calculateFinalLighting(albedo.rgb, finalColor);
+ finalLighting = max(finalLighting *= _PPLightingMultiplier, 0);
+
+ if (!_LightingUncapped)
+ {
+ finalLighting = saturate(finalLighting);
+ }
+
+ #ifdef SUBSURFACE
+ finalSSS = calculateSubsurfaceScattering();
+ //finalSSS = calculateSubsurfaceScattering(albedo);
+ #endif
+ #endif
+
+ float4 finalColorBeforeLighting = albedo;
+ finalColor = finalColorBeforeLighting;
+
+ #ifdef POI_SPECULAR
+ finalSpecular0 = calculateSpecular(finalColorBeforeLighting);
+ #endif
+ #ifdef POI_PARALLAX
+ calculateAndApplyInternalParallax(finalColor);
+ #endif
+
+ #ifdef POI_ALPHA_TO_COVERAGE
+ ApplyAlphaToCoverage(finalColor);
+ #endif
+
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaToMask == 1)
+ {
+ applyDithering(finalColor);
+ }
+ }
+
+
+ #ifdef POI_METAL
+ calculateMetallicness();
+ bool probeExists = shouldMetalHappenBeforeLighting();
+ UNITY_BRANCH
+ if (!probeExists)
+ {
+ ApplyMetallicsFake(finalColor, albedo);
+ }
+ #endif
+
+
+ #ifdef POI_LIGHTING
+ emissionLighting = finalLighting;
+ #if defined(FORWARD_ADD_PASS) && defined(POI_METAL)
+ finalLighting *= 1 - metalicMap;
+ #endif
+ applyLighting(finalColor, finalLighting);
+ #endif
+
+ #ifdef POI_BRDF
+ poiBRDF(finalColor, finalColorBeforeLighting);
+ #endif
+
+ #ifdef POI_METAL
+ UNITY_BRANCH
+ if (probeExists)
+ {
+ ApplyMetallics(finalColor, albedo);
+ }
+ #endif
+
+ finalColor.rgb += finalSpecular0 + finalEnvironmentalRim + finalSSS;
+
+ #ifdef FORWARD_BASE_PASS
+ #ifdef POI_CLEARCOAT
+ calculateAndApplyClearCoat(finalColor);
+ #endif
+ #endif
+
+ finalColor.a = saturate(finalColor.a);
+
+ /**********************************************************************
+ Add Up all the emission values :D
+ **********************************************************************/
+ //#if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ finalEmission += finalColorBeforeLighting.rgb * _MainEmissionStrength * albedo.a;
+ finalEmission += wireframeEmission;
+ finalEmission += IridescenceEmission;
+ finalEmission += spawnInEmission;
+ finalEmission += voronoiEmission;
+ finalEmission += matcapEmission;
+ finalEmission += depthTouchEmission;
+ finalEmission += decalEmission;
+ finalEmission += glitterEmission;
+ finalEmission += panosphereEmission;
+ finalEmission += backFaceEmission;
+ finalEmission += rimLightEmission;
+ finalEmission += flipbookEmission;
+ finalEmission += videoEmission;
+ finalEmission += textOverlayEmission;
+ finalEmission += dissolveEmission;
+ finalEmission += pathEmission;
+ #ifdef POI_EMISSION
+ finalEmission += calculateEmissionNew(finalColorBeforeLighting.rgb, finalColor);
+ #endif
+
+ finalEmission = max(finalEmission * _PPEmissionMultiplier, 0);
+
+ //#endif
+ // Compensate for HDR lights
+ #if defined(FORWARD_ADD_PASS)
+ finalEmission *= emissionLighting; // TODO: add in vertex lights
+ #else
+ finalEmission *= max(1, emissionLighting);
+ #endif
+
+ /**********************************************************************
+ Meta Pass Hype :D
+ **********************************************************************/
+ #ifdef POI_META_PASS
+ UnityMetaInput meta;
+ UNITY_INITIALIZE_OUTPUT(UnityMetaInput, meta);
+ meta.Emission = finalEmission * _GIEmissionMultiplier;
+ meta.Albedo = saturate(finalColor.rgb);
+ #ifdef POI_SPECULAR
+ meta.SpecularColor = poiLight.color.rgb * _SpecularTint.rgb * lerp(1, albedo.rgb, _SpecularMetallic) * _SpecularTint.a;
+ #else
+ meta.SpecularColor = poiLight.color.rgb * albedo.rgb;
+ #endif
+ return UnityMetaFragment(meta);
+ #endif
+
+ /**********************************************************************
+ Apply Emission to finalColor
+ **********************************************************************/
+ finalColor.rgb += finalEmission;
+
+ /**********************************************************************
+ Grabpass features
+ **********************************************************************/
+
+ UNITY_BRANCH
+ if (_commentIfZero_EnableGrabpass)
+ {
+ applyGrabEffects(finalColor);
+ }
+
+ /**********************************************************************
+ Unity Fog
+ **********************************************************************/
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, finalColor);
+ }
+ #endif
+
+ #ifdef FORWARD_ADD_PASS
+ if (_Mode > 0)
+ {
+ finalColor.rgb *= finalColor.a;
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_Mode == 0)
+ {
+ finalColor.a = 1;
+ }
+
+ #ifdef FORWARD_ADD_PASS
+ //finalColor.rgb = smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5));
+ #endif
+
+ #ifdef POI_DEBUG
+ displayDebugInfo(finalColor);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_AudioLinkTextureVisualization)
+ {
+ finalColor = poiMods.audioLinkTexture;
+ }
+ #endif
+
+ #ifdef FORWARD_ADD_PASS
+ #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) && defined(DIRECTIONAL)
+ return finalColor + albedo * 0.00001;;
+ #endif
+ #endif
+
+ //finalColor.rgb = frac(finalColor.rgb);
+ return finalColor + mainTexture * 0.00001;
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFrag.cginc.meta
new file mode 100644
index 00000000..1469bed5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 60cd78e9ddf39f8488c9f5574a8a5a7b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGlitter.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGlitter.cginc
new file mode 100644
index 00000000..fead7309
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGlitter.cginc
@@ -0,0 +1,274 @@
+#ifndef POI_GLITTER
+ #define POI_GLITTER
+
+ half3 _GlitterColor;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterRandomRotation;
+ float _GlitterTextureRotation;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomSize;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_GlitterMask);
+ #endif
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_GlitterColorMap);
+ #endif
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_GlitterTexture);
+ #endif
+
+ float3 randomFloat3(float2 Seed, float maximum)
+ {
+ return(.5 + float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return(float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + _GlitterSpeed;
+ return float3(sin((_Time.x + rando.x * pi) * speed), sin((_Time.x + rando.y * pi) * speed), sin((_Time.x + rando.z * pi) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ float3 hsv = float3(hue, saturation, value);
+ return HSVtoRGB(hsv);
+ }
+
+ void applyGlitter(inout float4 albedo, inout float3 glitterEmission)
+ {
+
+
+ // Scale
+ float2 st = frac(poiMesh.uv[0] + _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;
+ float2 dank;
+ for (int j = -1; j <= 1; j ++)
+ {
+ for (int i = -1; i <= 1; i ++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if(_GlitterRandomSize)
+ {
+ size = remapClamped(randomFromPoint, 0, 1, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = (1. - step(size, m_dist));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if(_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ switch(_GlitterMode)
+ {
+ case 0:
+ float3 randomRotation = 0;
+ UNITY_BRANCH
+ if(_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+ float3 norm = poiMesh.normals[0];
+
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ }
+
+
+ half3 glitterColor = _GlitterColor;
+ glitterColor *= lerp(1, albedo, _GlitterUseSurfaceColor);
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ glitterColor *= POI2D_SAMPLER_PAN(_GlitterColorMap, _MainTex, poiMesh.uv[_GlitterColorMapUV], _GlitterColorMapPan).rgb;
+ #endif
+ float2 uv = remapClamped(dank, -size, size, 0, 1);
+ UNITY_BRANCH
+ if(_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if(_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, uv, _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiMesh.uv[_GlitterMaskUV], _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if(_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if(_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if(_GlitterBlendType == 1)
+ {
+ albedo.rgb = lerp(albedo.rgb, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ glitterEmission = finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ glitterEmission = finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGlitter.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGlitter.cginc.meta
new file mode 100644
index 00000000..3138813f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGlitter.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 951e19b6f0892c246b81926ee196e733
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGrab.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGrab.cginc
new file mode 100644
index 00000000..d8a3d424
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGrab.cginc
@@ -0,0 +1,125 @@
+#ifndef POI_GRAB
+ #define POI_GRAB
+
+ float _RefractionIndex;
+ float _RefractionOpacity;
+ float _RefractionChromaticAberattion;
+ float _RefractionEnabled;
+ float _GrabSrcBlend;
+ float _GrabDstBlend;
+ float _GrabPassUseAlpha;
+ float _GrabPassBlendFactor;
+ float _GrabBlurDistance;
+ float _GrabBlurQuality;
+ float _GrabBlurDirections;
+ POI_TEXTURE_NOSAMPLER(_GrabPassBlendMap);
+
+ float4 blur(float2 uv)
+ {
+ float two_pi = 6.28318530718;
+
+ float2 radius = _GrabBlurDistance / _ScreenParams.xy * 100; // Arbitrary constant to match old blur
+ float quality = floor(_GrabBlurQuality);
+ float directions = floor(_GrabBlurDirections);
+
+ // Pixel colour
+ float4 color = tex2D(_PoiGrab, uv);
+
+ float deltaAngle = two_pi / directions;
+ float deltaQuality = 1.0 / quality;
+ for (int i = 0; i < directions; i ++)
+ {
+ for (int j = 0; j < quality; j ++)
+ {
+ float angle = deltaAngle * i + j;
+ float offset = deltaQuality * (j + 1);
+ color += tex2D(_PoiGrab, uv + float2(cos(angle), sin(angle)) * radius * offset);
+ }
+ }
+
+ // Output to screen
+ color /= quality * directions + 1;
+ return color;
+ }
+
+ inline float4 Refraction(float indexOfRefraction, float chromaticAberration, float2 projectedGrabPos)
+ {
+ float4 refractionColor;
+ float3 worldViewDir = normalize(UnityWorldSpaceViewDir(poiMesh.worldPos));
+ float3 refractionOffset = ((((indexOfRefraction - 1.0) * mul(UNITY_MATRIX_V, float4(poiMesh.normals[1], 0.0)).xyz) * (1.0 / (poiCam.grabPos.z + 1.0))) * (1.0 - dot(poiMesh.normals[1], worldViewDir)));
+ float2 cameraRefraction = float2(refractionOffset.x, - (refractionOffset.y * _ProjectionParams.x));
+
+ UNITY_BRANCH
+ if (_RefractionChromaticAberattion > 0)
+ {
+ float4 redAlpha = tex2D(_PoiGrab, (projectedGrabPos + cameraRefraction));
+ float green = tex2D(_PoiGrab, (projectedGrabPos + (cameraRefraction * (1.0 - chromaticAberration)))).g;
+ float blue = tex2D(_PoiGrab, (projectedGrabPos + (cameraRefraction * (1.0 + chromaticAberration)))).b;
+ refractionColor = float4(redAlpha.r, green, blue, redAlpha.a);
+ }
+ else
+ {
+ float2 refractedGrab = projectedGrabPos + cameraRefraction;
+
+ #ifdef CHROMATIC_ABERRATION_LOW
+ refractionColor = blur(refractedGrab);
+ #else
+ refractionColor = tex2D(_PoiGrab, (refractedGrab));
+ #endif
+ }
+ return refractionColor;
+ }
+
+ void calculateRefraction(float2 projectedGrabPos, inout float4 finalColor)
+ {
+ float3 refraction = 1;
+ UNITY_BRANCH
+ if(_RefractionEnabled == 1)
+ {
+ refraction = Refraction(_RefractionIndex, _RefractionChromaticAberattion, projectedGrabPos).rgb;
+ }
+ else
+ {
+ #ifdef CHROMATIC_ABERRATION_LOW
+ refraction = blur(projectedGrabPos);
+ #else
+ refraction = tex2Dproj(_PoiGrab, poiCam.grabPos).rgb;
+ #endif
+ }
+
+ float blendFactor = _GrabPassBlendFactor * POI2D_SAMPLER_PAN(_GrabPassBlendMap, _MainTex, poiMesh.uv[_GrabPassBlendMapUV], _GrabPassBlendMapPan).r;
+ UNITY_BRANCH
+ if(_GrabPassUseAlpha)
+ {
+ finalColor = poiBlend(_GrabSrcBlend, finalColor, _GrabDstBlend, float4(refraction, 1), blendFactor * (1 - finalColor.a));
+ finalColor.a = 1;
+ }
+ else
+ {
+ finalColor = poiBlend(_GrabSrcBlend, finalColor, _GrabDstBlend, float4(refraction, 1), blendFactor);
+ }
+ }
+
+ float2 calculateGrabPosition()
+ {
+ float4 grabPos = poiCam.grabPos;
+ #if UNITY_UV_STARTS_AT_TOP
+ float scale = -1.0;
+ #else
+ float scale = 1.0;
+ #endif
+ float halfPosW = grabPos.w * 0.5;
+ grabPos.y = (grabPos.y - halfPosW) * _ProjectionParams.x * scale + halfPosW;
+ #if SHADER_API_D3D9 || SHADER_API_D3D11
+ grabPos.w += 0.00000000001;
+ #endif
+ return(grabPos / grabPos.w).xy;
+ }
+
+ void applyGrabEffects(inout float4 finalColor)
+ {
+ float2 projectedGrabPos = calculateGrabPosition();
+ calculateRefraction(projectedGrabPos, finalColor);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGrab.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGrab.cginc.meta
new file mode 100644
index 00000000..d01d8517
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiGrab.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 31b4450700d5cc244853b4488e455231
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHelpers.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHelpers.cginc
new file mode 100644
index 00000000..e71e6ef3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHelpers.cginc
@@ -0,0 +1,336 @@
+#ifndef POI_HELPER
+#define POI_HELPER
+
+#ifndef pi
+ #define pi float(3.14159265359)
+#endif
+
+float linearSin(float x)
+{
+ return pow(min(cos(pi * x / 2.0), 1.0 - abs(x)), 1.0);
+}
+
+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(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 mod(float3 x, float y)
+{
+ return x - y * floor(x / y);
+}
+float2 mod(float2 x, float y)
+{
+ return x - y * floor(x / y);
+}
+
+//1/7
+#define K 0.142857142857
+//3/7
+#define Ko 0.428571428571
+
+// Permutation polynomial: (34x^2 + x) mod 289
+float3 Permutation(float3 x)
+{
+ return mod((34.0 * x + 1.0) * x, 289.0);
+}
+
+bool IsInMirror()
+{
+ return unity_CameraProjection[2][0] != 0.f || unity_CameraProjection[2][1] != 0.f;
+}
+
+float3 BoxProjection(float3 direction, float3 position, float4 cubemapPosition, float3 boxMin, float3 boxMax)
+{
+ #if UNITY_SPECCUBE_BOX_PROJECTION
+ UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #endif
+ return direction;
+}
+
+// Camera
+float3 getCameraPosition()
+{
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+}
+
+float3 getCameraForward()
+{
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+}
+
+float3 grayscale_vector_node()
+{
+ return float3(0, 0.3823529, 0.01845836);
+}
+
+float3 grayscale_for_light()
+{
+ return float3(0.298912, 0.586611, 0.114478);
+}
+
+//Math Operators
+
+float remap(float x, float minOld, float maxOld, float minNew, float maxNew)
+{
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+}
+
+float2 remap(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew)
+{
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+}
+
+float3 remap(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew)
+{
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+}
+
+float4 remap(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew)
+{
+ return minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld);
+}
+
+float remapClamped(float x, float minOld, float maxOld, float minNew, float maxNew)
+{
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+}
+
+float2 remapClamped(float2 x, float2 minOld, float2 maxOld, float2 minNew, float2 maxNew)
+{
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+}
+
+float3 remapClamped(float3 x, float3 minOld, float3 maxOld, float3 minNew, float3 maxNew)
+{
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+}
+
+float4 remapClamped(float4 x, float4 minOld, float4 maxOld, float4 minNew, float4 maxNew)
+{
+ return clamp(minNew + (x - minOld) * (maxNew - minNew) / (maxOld - minOld), minNew, maxNew);
+}
+
+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);
+}
+
+float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+{
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+}
+
+float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+{
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+}
+
+#endif
+
+half2 calcScreenUVs(half4 grabPos)
+{
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #else
+ uv.xy *= _ScreenParams.xy;
+ #endif
+
+ return uv;
+}
+
+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);
+}
+
+// Dithering
+inline half Dither8x8Bayer(int x, int y)
+{
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+}
+
+// UV Manipulation
+float2 TransformUV(half2 offset, half rotation, half2 scale, float2 uv)
+{
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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));
+}
+
+bool isVR()
+{
+ // USING_STEREO_MATRICES
+ #if UNITY_SINGLE_PASS_STEREO
+ return true;
+ #else
+ return false;
+ #endif
+}
+
+bool isVRHandCamera()
+{
+ return !isVR() && abs(UNITY_MATRIX_V[0].y) > 0.0000005;
+}
+
+bool isDesktop()
+{
+ return !isVRHandCamera();
+}
+
+bool isVRHandCameraPreview()
+{
+ return isVRHandCamera() && _ScreenParams.y == 720;
+}
+
+bool isVRHandCameraPicture()
+{
+ return isVRHandCamera() && _ScreenParams.y == 1080;
+}
+
+bool isPanorama()
+{
+ // Crude method
+ // FOV=90=camproj=[1][1]
+ return unity_CameraProjection[1][1] == 1 && _ScreenParams.x == 1075 && _ScreenParams.y == 1025;
+}
+
+float calculateluminance(float3 color)
+{
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHelpers.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHelpers.cginc.meta
new file mode 100644
index 00000000..233c26f9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHelpers.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: fb03052ea8dc42740b104275ae961ae0
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHologram.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHologram.cginc
new file mode 100644
index 00000000..af9e781d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHologram.cginc
@@ -0,0 +1,44 @@
+#ifndef POI_HOLOGRAM
+#define POI_HOLOGRAM
+
+#if defined(PROP_HOLOALPHAMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_HoloAlphaMap); float4 _HoloAlphaMap_ST;
+#endif
+float _HoloCoordinateSpace; // 0 World, 1 Local, 2 UV
+float3 _HoloDirection;
+float _HoloScrollSpeed;
+float _HoloLineDensity;
+
+fixed _HoloFresnelAlpha;
+fixed _HoloRimSharpness;
+fixed _HoloRimWidth;
+
+void ApplyHoloAlpha(inout float4 color)
+{
+ float uv = 0;
+ UNITY_BRANCH
+ if (_HoloCoordinateSpace == 0)
+ {
+ uv = dot(normalize(_HoloDirection), poiMesh.worldPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ UNITY_BRANCH
+ if (_HoloCoordinateSpace == 1)
+ {
+ uv = dot(normalize(_HoloDirection), poiMesh.localPos * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ UNITY_BRANCH
+ if (_HoloCoordinateSpace == 2)
+ {
+ uv = dot(_HoloDirection, poiMesh.uv[0] * _HoloLineDensity) + _Time.x * _HoloScrollSpeed;
+ }
+ float holoRim = saturate(1 - smoothstep(min(_HoloRimSharpness, _HoloRimWidth), _HoloRimWidth, poiCam.viewDotNormal));
+ holoRim = abs(lerp(1, holoRim, _HoloFresnelAlpha));
+ #if defined(PROP_HOLOALPHAMAP) || !defined(OPTIMIZER_ENABLED)
+ fixed holoAlpha = UNITY_SAMPLE_TEX2D_SAMPLER(_HoloAlphaMap, _MainTex, uv).r;
+ #else
+ fixed holoAlpha = 1;
+ #endif
+ color.a *= holoAlpha * holoRim;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHologram.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHologram.cginc.meta
new file mode 100644
index 00000000..f342f3b6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiHologram.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ea5f0a88cd7909642be3bb003cd6c291
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiIridescence.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiIridescence.cginc
new file mode 100644
index 00000000..053a4d48
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiIridescence.cginc
@@ -0,0 +1,104 @@
+#ifndef POI_IRIDESCENCE
+#define POI_IRIDESCENCE
+#if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceRamp); float4 _IridescenceRamp_ST;
+#endif
+#if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceMask); float4 _IridescenceMask_ST;
+#endif
+#if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_IridescenceNormalMap); float4 _IridescenceNormalMap_ST;
+#endif
+float _IridescenceNormalUV;
+float _IridescenceMaskUV;
+float _IridescenceNormalSelection;
+float _IridescenceNormalIntensity;
+float _IridescenceNormalToggle;
+float _IridescenceIntensity;
+fixed _IridescenceAddBlend;
+fixed _IridescenceReplaceBlend;
+fixed _IridescenceMultiplyBlend;
+float _IridescenceEmissionStrength;
+float _IridescencePanSpeed;
+half _IridescenceOffset;
+
+half _IridescenceHueShiftEnabled;
+half _IridescenceHueShiftSpeed;
+half _IridescenceHueShift;
+
+#ifdef POI_AUDIOLINK
+ half _IridescenceAudioLinkEmissionBand;
+ half2 _IridescenceAudioLinkEmission;
+#endif
+
+//global
+#if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ float3 calculateNormal(float3 baseNormal)
+ {
+
+ float3 normal = UnpackScaleNormal(UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceNormalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[_IridescenceNormalUV], _IridescenceNormalMap)), _IridescenceNormalIntensity);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ normal.z * baseNormal
+ );
+ }
+#endif
+
+void applyIridescence(inout float4 albedo, inout float3 IridescenceEmission)
+{
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ // Use custom normal map
+ UNITY_BRANCH
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(normal);
+ }
+ #endif
+
+ float ndotv = abs(dot(normal, poiCam.viewDir)) + _Time.x * _IridescencePanSpeed + _IridescenceOffset;
+
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ float4 iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, ndotv);
+ #else
+ float4 iridescenceColor = 1;
+ #endif
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 iridescenceMask = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceMask, _MainTex, TRANSFORM_TEX(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask));
+ #else
+ float4 iridescenceMask = 1;
+ #endif
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_IridescenceHueShiftEnabled)
+ {
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, _IridescenceHueShift + _Time.x * _IridescenceHueShiftSpeed);
+ }
+
+ albedo.rgb = lerp(albedo.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ albedo.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ albedo.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ half emissionStrength = _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmission.x, _IridescenceAudioLinkEmission.y, poiMods.audioLink[_IridescenceAudioLinkEmissionBand]);
+ }
+ #endif
+
+ IridescenceEmission = saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiIridescence.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiIridescence.cginc.meta
new file mode 100644
index 00000000..db93f998
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiIridescence.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 72605619fbb558a40926b8b605114f53
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiLighting.cginc
new file mode 100644
index 00000000..57231740
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiLighting.cginc
@@ -0,0 +1,962 @@
+
+#ifndef POI_LIGHTING
+#define POI_LIGHTING
+
+float _LightingRampType;
+float _LightingIgnoreAmbientColor;
+float _UseShadowTexture;
+float _LightingEnableAO;
+float _LightingDetailShadowsEnabled;
+
+float _LightingOnlyUnityShadows;
+float _LightingMode;
+float _ForceLightDirection;
+float _ShadowStrength;
+float _OutlineShadowStrength;
+float _ShadowOffset;
+float3 _LightDirection;
+float _ForceShadowStrength;
+float _CastedShadowSmoothing;
+float _AttenuationMultiplier;
+float _EnableLighting;
+float _LightingControlledUseLightColor;
+fixed _LightingStandardSmoothness;
+fixed _LightingStandardControlsToon;
+fixed _LightingMinLightBrightness;
+float _LightingUseShadowRamp;
+float _LightingMinShadowBrightnessRatio;
+fixed _LightingMonochromatic;
+
+fixed _LightingGradientStart;
+fixed _LightingGradientEnd;
+float3 _LightingShadowColor;
+float _AOStrength;
+fixed _LightingDetailStrength;
+fixed _LightingAdditiveDetailStrength;
+fixed _LightingNoIndirectMultiplier;
+fixed _LightingNoIndirectThreshold;
+float _LightingUncapped;
+
+float _LightingDirectColorMode;
+float _LightingIndirectColorMode;
+float _LightingAdditiveType;
+fixed _LightingAdditiveGradientStart;
+fixed _LightingAdditiveGradientEnd;
+fixed _LightingAdditivePassthrough;
+float _LightingDirectAdjustment;
+float _LightingIndirect;
+// HSL JUNK
+float _LightingEnableHSL;
+float _LightingShadowHue;
+float _LightingShadowSaturation;
+float _LightingShadowLightness;
+float _LightingHSLIntensity;
+// UTS Style Shade Mapping
+float4 _1st_ShadeColor;
+float _Use_BaseAs1st;
+float4 _2nd_ShadeColor;
+float _Use_1stAs2nd;
+float _BaseColor_Step;
+float _BaseShade_Feather;
+float _ShadeColor_Step;
+float _1st2nd_Shades_Feather;
+float _Use_1stShadeMapAlpha_As_ShadowMask;
+float _1stShadeMapMask_Inverse;
+float _Tweak_1stShadingGradeMapLevel;
+float _Use_2ndShadeMapAlpha_As_ShadowMask;
+float _2ndShadeMapMask_Inverse;
+float _Tweak_2ndShadingGradeMapLevel;
+// Skin
+float _SkinScatteringProperties;
+float _SssWeight;
+float _SssMaskCutoff ;
+float _SssBias;
+float _SssScale;
+float _SssBumpBlur;
+float4 _SssTransmissionAbsorption;
+float4 _SssColorBleedAoWeights;
+/*
+UNITY_DECLARE_TEX2D_NOSAMPLER(_ToonRamp3);
+half _LightingShadowStrength3;
+half _ShadowOffset3;
+*/
+
+half4 shadowStrength;
+sampler2D _SkinLUT;
+UNITY_DECLARE_TEX2D(_ToonRamp);
+POI_TEXTURE_NOSAMPLER(_1st_ShadeMap);
+POI_TEXTURE_NOSAMPLER(_2nd_ShadeMap);
+POI_TEXTURE_NOSAMPLER(_LightingDetailShadows);
+POI_TEXTURE_NOSAMPLER(_LightingAOTex);
+POI_TEXTURE_NOSAMPLER(_LightingShadowMask);
+
+float3 directLighting;
+float3 indirectLighting;
+/*
+* DJLs code starts here
+*/
+float _LightingWrappedWrap;
+float _LightingWrappedNormalization;
+
+// Green’s model with adjustable energy
+// http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+// Modified for adjustable conservation ratio and over-wrap to directionless
+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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+}
+float3 ShadeSH9_wrapped(float3 normal, float wrap)
+{
+ 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;
+}
+
+/*
+* MIT License
+*
+* Copyright (c) 2018 s-ilent
+*
+* 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
+* 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.
+*/
+
+/*
+* Silent's code starts here
+*/
+
+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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+}
+
+float3 BetterSH9(float3 normal)
+{
+ return BetterSH9(float4(normal, 1));
+}
+
+/*
+* Standard stuff starts here
+*/
+UnityLight CreateLight(float3 normal, fixed detailShadowMap)
+{
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, _AttenuationMultiplier) * detailShadowMap);
+ light.ndotl = DotClamped(normal, poiLight.direction);
+ return light;
+}
+
+float FadeShadows(float attenuation)
+{
+ #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 = lerp(1, poiLight.attenuation, _AttenuationMultiplier);
+ #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)
+{
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ indirectLight.diffuse = min(subtractedLight, indirectLight.diffuse);
+ #endif
+}
+
+float3 weightedBlend(float3 layer1, float3 layer2, float2 weights)
+{
+ return(weights.x * layer1 + weights.y * layer2) / (weights.x + weights.y);
+}
+
+UnityIndirect CreateIndirectLight(float3 normal)
+{
+ UnityIndirect indirectLight;
+ indirectLight.diffuse = 0;
+ indirectLight.specular = 0;
+
+ #if defined(FORWARD_BASE_PASS)
+ #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, normal
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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, normal
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(normal, 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(normal, 1)));
+ #endif
+ #endif
+
+ float3 reflectionDir = reflect(-poiCam.viewDir, normal);
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = 1 - _LightingStandardSmoothness;
+ envData.reflUVW = BoxProjection(
+ reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube0_ProbePosition,
+ unity_SpecCube0_BoxMin.xyz, unity_SpecCube0_BoxMax.xyz
+ );
+ float3 probe0 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData
+ );
+ envData.reflUVW = BoxProjection(
+ reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz
+ );
+ #if UNITY_SPECCUBE_BLENDING
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 probe1 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0),
+ unity_SpecCube0_HDR, envData
+ );
+ indirectLight.specular = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ indirectLight.specular = probe0;
+ }
+ #else
+ indirectLight.specular = probe0;
+ #endif
+ float occlusion = 1;
+ UNITY_BRANCH
+ if (_LightingEnableAO)
+ {
+ occlusion = lerp(1, POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[_LightingAOTexUV], _LightingAOTexPan).r, _AOStrength);
+ }
+
+ indirectLight.diffuse *= occlusion;
+ indirectLight.diffuse = max(indirectLight.diffuse, _LightingMinLightBrightness);
+ indirectLight.specular *= occlusion;
+ #endif
+
+ return indirectLight;
+}
+
+/*
+* Poiyomi's cool as heck code starts here :smug:
+*/
+
+half PoiDiffuse(half NdotV, half NdotL, half LdotH)
+{
+ half fd90 = 0.5 + 2 * LdotH * LdotH * SmoothnessToPerceptualRoughness(.5);
+ // Two schlick fresnel term
+ half lightScatter = (1 + (fd90 - 1) * Pow5(1 - NdotL));
+ half viewScatter = (1 + (fd90 - 1) * Pow5(1 - NdotV));
+
+ return lightScatter * viewScatter;
+}
+
+float3 ShadeSH9Indirect()
+{
+ return ShadeSH9(half4(0.0, -1.0, 0.0, 1.0));
+}
+
+float3 ShadeSH9Direct()
+{
+ return ShadeSH9(half4(0.0, 1.0, 0.0, 1.0));
+}
+
+float3 ShadeSH9Normal(float3 normalDirection)
+{
+ return ShadeSH9(half4(normalDirection, 1.0));
+}
+
+half3 GetSHLength()
+{
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ x1.b = length(unity_SHBb);
+ return x + x1;
+}
+half3 GetSHDirectionL1()
+{
+ //float3 grayscale = float3(.3, .59, .11);
+ float3 grayscale = float3(.33333, .33333, .33333);
+ half3 r = Unity_SafeNormalize(half3(unity_SHAr.x, unity_SHAr.y, unity_SHAr.z));
+ half3 g = Unity_SafeNormalize(half3(unity_SHAg.x, unity_SHAg.y, unity_SHAg.z));
+ half3 b = Unity_SafeNormalize(half3(unity_SHAb.x, unity_SHAb.y, unity_SHAb.z));
+ return Unity_SafeNormalize(grayscale.r * r + grayscale.g * g + grayscale.b * b);
+}
+float3 GetSHDirectionL1_()
+{
+ // For efficiency, we only get the direction from L1.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+}
+// Returns the value from SH in the lighting direction with the
+// brightest intensity.
+half3 GetSHMaxL1()
+{
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+}
+
+
+float3 calculateRealisticLighting(float4 colorToLight, fixed detailShadowMap)
+{
+ return UNITY_BRDF_PBS(1, 0, 0, _LightingStandardSmoothness, poiMesh.normals[1], poiCam.viewDir, CreateLight(poiMesh.normals[1], detailShadowMap), CreateIndirectLight(poiMesh.normals[1])).xyz;
+}
+
+void calculateBasePassLightMaps()
+{
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ float AOMap = 1;
+ float AOStrength = 0;
+ float3 lightColor = poiLight.color;
+ /*
+ * Generate Basic Light Maps
+ */
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+ #ifndef OUTLINE
+ UNITY_BRANCH
+ if (_LightingEnableAO)
+ {
+ AOMap = POI2D_SAMPLER_PAN(_LightingAOTex, _MainTex, poiMesh.uv[_LightingAOTexUV], _LightingAOTexPan).r;
+ AOStrength = _AOStrength;
+ poiLight.occlusion = lerp(1, AOMap, AOStrength);
+ }
+ #ifdef FORWARD_BASE_PASS
+ //poiLight.color = saturate(_LightColor0.rgb) + saturate(ShadeSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)));
+ if (lightExists)
+ {
+ lightColor = _LightColor0.rgb + BetterSH9(float4(0, 0, 0, 1));
+ }
+ else
+ {
+ lightColor = BetterSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb));
+ }
+
+ //lightColor = magic * magiratio + normalLight * normaRatio;
+ //lightColor = magic + normalLight;
+ #endif
+ #endif
+
+ float3 grayscale_vector = float3(.33333, .33333, .33333);
+ 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;
+
+ shadowStrength = 1;
+ #ifndef OUTLINE
+ shadowStrength = POI2D_SAMPLER_PAN(_LightingShadowMask, _MainTex, poiMesh.uv[_LightingShadowMaskUV], _LightingShadowMaskPan) * _ShadowStrength;
+ #else
+ shadowStrength = _OutlineShadowStrength;
+ #endif
+
+ float bw_lightColor = dot(lightColor, grayscale_vector);
+ float bw_directLighting = (((poiLight.nDotL * 0.5 + 0.5) * bw_lightColor * lerp(1, poiLight.attenuation, _AttenuationMultiplier)) + dot(ShadeSH9Normal(poiMesh.normals[1]), grayscale_vector));
+ float bw_bottomIndirectLighting = dot(ShadeSH9Minus, grayscale_vector);
+ float bw_topIndirectLighting = dot(ShadeSH9Plus, grayscale_vector);
+ float lightDifference = ((bw_topIndirectLighting + bw_lightColor) - bw_bottomIndirectLighting);
+
+ fixed detailShadow = 1;
+ UNITY_BRANCH
+ if (_LightingDetailShadowsEnabled)
+ {
+ detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingDetailStrength).r;
+ }
+ UNITY_BRANCH
+ if (_LightingOnlyUnityShadows)
+ {
+ poiLight.lightMap = poiLight.attenuation;
+ }
+ else
+ {
+ poiLight.lightMap = smoothstep(0, lightDifference, bw_directLighting - bw_bottomIndirectLighting);
+ }
+ poiLight.lightMap *= detailShadow;
+
+ /*
+ * Decide on light colors
+ */
+
+ indirectLighting = 0;
+ directLighting = 0;
+
+
+
+ UNITY_BRANCH
+ if (_LightingIndirectColorMode == 1)
+ {
+ indirectLighting = BetterSH9(float4(poiMesh.normals[1], 1));
+ }
+ else
+ {
+ indirectLighting = ShadeSH9Minus;
+ }
+
+ poiLight.directLighting = lightColor;
+ poiLight.indirectLighting = indirectLighting;
+
+
+ UNITY_BRANCH
+ if (_LightingDirectColorMode == 0)
+ {
+ 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 * poiLight.occlusion + normalLight;
+ float properLuminance = calculateluminance(magic + normalLight);
+ directLighting = properLightColor * max(0.0001, (target / properLuminance));
+ }
+ else
+ {
+ if (lightExists)
+ {
+ directLighting = _LightColor0.rgb + BetterSH9(float4(0, 0, 0, 1)) * poiLight.occlusion;
+ }
+ else
+ {
+ directLighting = max(BetterSH9(normalize(unity_SHAr + unity_SHAg + unity_SHAb)), 0);
+ }
+ }
+
+ UNITY_BRANCH
+ if (!_LightingUncapped)
+ {
+ float directluminance = calculateluminance(directLighting);
+ float indirectluminance = calculateluminance(indirectLighting);
+ directLighting = min(directLighting, directLighting / max(0.0001, (directluminance / 1)));
+ indirectLighting = min(indirectLighting, indirectLighting / max(0.0001, (indirectluminance / 1)));
+ }
+
+ directLighting = lerp(directLighting, dot(directLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+ indirectLighting = lerp(indirectLighting, dot(indirectLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+
+
+ if (max(max(indirectLighting.x, indirectLighting.y), indirectLighting.z) <= _LightingNoIndirectThreshold && max(max(directLighting.x, directLighting.y), directLighting.z) >= 0)
+ {
+ indirectLighting = directLighting * _LightingNoIndirectMultiplier;
+ }
+
+
+ UNITY_BRANCH
+ if (_LightingMinShadowBrightnessRatio)
+ {
+ float directluminance = clamp(directLighting.r * 0.299 + directLighting.g * 0.587 + directLighting.b * 0.114, 0, 1);
+ if (directluminance > 0)
+ {
+ indirectLighting = max(0.001, indirectLighting);
+ }
+ float indirectluminance = clamp(indirectLighting.r * 0.299 + indirectLighting.g * 0.587 + indirectLighting.b * 0.114, 0, 1);
+ float targetluminance = directluminance * _LightingMinShadowBrightnessRatio;
+ if (indirectluminance < targetluminance)
+ {
+ indirectLighting = indirectLighting / max(0.0001, indirectluminance / targetluminance);
+ }
+ }
+
+ poiLight.rampedLightMap = 1 - smoothstep(0, .5, 1 - poiLight.lightMap);
+ poiLight.finalLighting = directLighting;
+
+ indirectLighting = max(indirectLighting, 0);
+ directLighting = max(directLighting, 0);
+
+ /*
+ * Create Gradiant Maps
+ */
+ switch(_LightingRampType)
+ {
+ case 0: // Ramp Texture
+
+ {
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength.r);
+ UNITY_BRANCH
+ if (_LightingIgnoreAmbientColor)
+ {
+ poiLight.finalLighting = lerp(poiLight.rampedLightMap * directLighting * poiLight.occlusion, directLighting, poiLight.rampedLightMap);
+ }
+ else
+ {
+ poiLight.finalLighting = lerp(indirectLighting * poiLight.occlusion, directLighting, poiLight.rampedLightMap);
+ }
+ }
+ break;
+ case 1: // Math Gradient
+
+ {
+ poiLight.rampedLightMap = saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - poiLight.lightMap));
+ float3 shadowColor = _LightingShadowColor;
+ UNITY_BRANCH
+ if (_UseShadowTexture)
+ {
+ shadowColor = 1;
+ }
+ UNITY_BRANCH
+ if (_LightingIgnoreAmbientColor)
+ {
+ poiLight.finalLighting = lerp((directLighting * shadowColor * poiLight.occlusion), (directLighting), saturate(poiLight.rampedLightMap + 1 - _ShadowStrength));
+ }
+ else
+ {
+ poiLight.finalLighting = lerp((indirectLighting * shadowColor * poiLight.occlusion), (directLighting), saturate(poiLight.rampedLightMap + 1 - _ShadowStrength));
+ }
+ }
+ break;
+ case 2:
+ {
+ poiLight.rampedLightMap = saturate(1 - smoothstep(0, .5, 1 - poiLight.lightMap));
+ poiLight.finalLighting = directLighting;
+ }
+ break;
+ }
+
+ // DJL stuff
+ if (_LightingMode == 2) // Wrapped
+ {
+ poiLight.directLighting = (_LightColor0.rgb) * saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * detailShadow * lerp(1, poiLight.attenuation, _AttenuationMultiplier);
+ poiLight.indirectLighting = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectColorMode], _LightingWrappedWrap) * poiLight.occlusion;
+
+ float3 ShadeSH9Plus_2 = GetSHMaxL1();
+ float bw_topDirectLighting_2 = dot(_LightColor0.rgb, grayscale_vector);
+ float bw_directLighting = dot(poiLight.directLighting, grayscale_vector);
+ float bw_indirectLighting = dot(poiLight.indirectLighting, grayscale_vector);
+ float bw_topIndirectLighting = dot(ShadeSH9Plus_2, grayscale_vector);
+
+ //poiLight.lightMap = saturate(dot(poiLight.indirectLighting + poiLight.directLighting, grayscale_vector));
+ poiLight.lightMap = smoothstep(0, bw_topIndirectLighting + bw_topDirectLighting_2, bw_indirectLighting + bw_directLighting);
+
+ poiLight.rampedLightMap = 1;
+ UNITY_BRANCH
+ if (_LightingRampType == 0) // Ramp Texture
+
+ {
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength.r);
+ }
+ else if (_LightingRampType == 1) // Math Gradient
+
+ {
+ poiLight.rampedLightMap = lerp(_LightingShadowColor * lerp(poiLight.indirectLighting, 1, _LightingIgnoreAmbientColor), float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - poiLight.lightMap)));
+ poiLight.rampedLightMap = lerp(float3(1, 1, 1), poiLight.rampedLightMap, shadowStrength.r);
+ }
+
+ poiLight.finalLighting = (poiLight.indirectLighting + poiLight.directLighting) * saturate(poiLight.rampedLightMap + 1 - _ShadowStrength);
+ }
+
+ if (!_LightingUncapped)
+ {
+ poiLight.finalLighting = saturate(poiLight.finalLighting);
+ }
+ //poiLight.finalLighting *= .8;
+ #endif
+}
+
+/*
+void applyShadowTexture(inout float4 albedo)
+{
+ UNITY_BRANCH
+ if (_UseShadowTexture && _LightingRampType == 1)
+ {
+ albedo.rgb = lerp(albedo.rgb, POI2D_SAMPLER_PAN(_LightingShadowTexture, _MainTex, poiMesh.uv[_LightingShadowTextureUV], _LightingShadowTexturePan) * _LightingShadowColor, (1 - poiLight.rampedLightMap) * shadowStrength);
+ }
+}
+*/
+
+float3 calculateNonImportantLighting(float attenuation, float attenuationDotNL, float3 albedo, float3 lightColor, half dotNL, half correctedDotNL)
+{
+ fixed detailShadow = 1;
+ UNITY_BRANCH
+ if (_LightingDetailShadowsEnabled)
+ {
+ detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingAdditiveDetailStrength).r;
+ }
+ UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ return lightColor * attenuationDotNL * detailShadow; // Realistic
+
+ }
+ else if (_LightingAdditiveType == 1) // Toon
+
+ {
+ return lerp(lightColor * attenuation, lightColor * _LightingAdditivePassthrough * attenuation, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, dotNL)) * detailShadow;
+ }
+ else //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-dotNL, _LightingWrappedWrap, _LightingWrappedNormalization)) * detailShadow;
+
+ poiLight.rampedLightMap = 1;
+ if (_LightingRampType == 1) // Math Gradient
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ // TODO: ramp texture or full shade/tint map for atlasing
+
+ return lightColor * poiLight.rampedLightMap * saturate(attenuation * uv);
+ }
+}
+
+void applyShadeMaps(inout float4 albedo)
+{
+ UNITY_BRANCH
+ if (_LightingRampType == 2)
+ {
+ float3 baseColor = albedo.rgb;
+
+ 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, poiMesh.uv[_1st_ShadeMapUV], _1st_ShadeMapPan);
+ #else
+ float4 firstShadeMap = float4(1, 1, 1, 1);
+ #endif
+ firstShadeMap = lerp(firstShadeMap, albedo, _Use_BaseAs1st);
+
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 secondShadeMap = POI2D_SAMPLER_PAN(_2nd_ShadeMap, _MainTex, poiMesh.uv[_2nd_ShadeMapUV], _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));
+
+ #if defined(PROP_LIGHTINGSHADOWMASK) || !defined(OPTIMIZER_ENABLED)
+ float removeShadow = POI2D_SAMPLER_PAN(_LightingShadowMask, _MainTex, poiMesh.uv[_LightingShadowMaskUV], _LightingShadowMaskPan).r;
+ #else
+ float removeShadow = 1;
+ #endif
+ mainShadowMask *= removeShadow;
+ firstSecondShadowMask *= removeShadow;
+
+ albedo.rgb = lerp(albedo.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+}
+
+float3 calculateFinalLighting(inout float3 albedo, float4 finalColor)
+{
+ float3 finalLighting = 1;
+ // Additive Lighting
+ #ifdef FORWARD_ADD_PASS
+ fixed detailShadow = 1;
+ UNITY_BRANCH
+ if (_LightingDetailShadowsEnabled)
+ {
+ detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingAdditiveDetailStrength).r;
+ }
+ UNITY_BRANCH
+ if (_LightingAdditiveType == 0) // Realistic
+
+ {
+ finalLighting = poiLight.color * poiLight.attenuation * max(0, poiLight.nDotL) * detailShadow * poiLight.additiveShadow;
+ }
+ else if (_LightingAdditiveType == 1) // Toon
+
+ {
+ #if defined(POINT) || defined(SPOT)
+ finalLighting = lerp(poiLight.color * max(poiLight.additiveShadow, _LightingAdditivePassthrough), poiLight.color * _LightingAdditivePassthrough, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * detailShadow;
+ #else
+ finalLighting = lerp(poiLight.color * max(poiLight.attenuation, _LightingAdditivePassthrough), poiLight.color * _LightingAdditivePassthrough, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * detailShadow;
+ #endif
+ }
+ else //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * detailShadow;
+
+ poiLight.rampedLightMap = 1;
+ UNITY_BRANCH
+ if (_LightingRampType == 1) // Math Gradient
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ // TODO: ramp texture or full shade/tint map for atlasing
+ //poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, float2(uv + _ShadowOffset, 1)), shadowStrength.r);
+
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ return poiLight.color * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ }
+ #endif
+
+ // Base and Meta Lighting
+ #if defined(FORWARD_BASE_PASS) || defined(POI_META_PASS)
+ #ifdef VERTEXLIGHT_ON
+ poiLight.vFinalLighting = 0;
+
+ for (int index = 0; index < 4; index++)
+ {
+ poiLight.vFinalLighting += calculateNonImportantLighting(poiLight.vAttenuation[index], poiLight.vAttenuationDotNL[index], albedo, poiLight.vColor[index], poiLight.vDotNL[index], poiLight.vCorrectedDotNL[index]);
+ }
+ #endif
+
+ switch(_LightingMode)
+ {
+ case 0: // Toon Lighting
+ case 2: // or wrapped
+
+ {
+ // HSL Shading
+ UNITY_BRANCH
+ if (_LightingEnableHSL)
+ {
+ float3 HSLMod = float3(_LightingShadowHue * 2 - 1, _LightingShadowSaturation * 2 - 1, _LightingShadowLightness * 2 - 1) * (1 - poiLight.rampedLightMap);
+ albedo = lerp(albedo.rgb, ModifyViaHSL(albedo.rgb, HSLMod), _LightingHSLIntensity);
+ }
+
+ // Normal Shading
+ UNITY_BRANCH
+ if (_LightingMinLightBrightness > 0)
+ {
+ poiLight.finalLighting = max(0.001, poiLight.finalLighting);
+ float finalluminance = calculateluminance(poiLight.finalLighting);
+ finalLighting = max(poiLight.finalLighting, poiLight.finalLighting / max(0.0001, (finalluminance / _LightingMinLightBrightness)));
+ poiLight.finalLighting = finalLighting;
+ }
+ else
+ {
+ finalLighting = poiLight.finalLighting;
+ }
+ }
+ break;
+ case 1: // realistic
+
+ {
+ fixed detailShadow = 1;
+ UNITY_BRANCH
+ if (_LightingDetailShadowsEnabled)
+ {
+ detailShadow = lerp(1, POI2D_SAMPLER_PAN(_LightingDetailShadows, _MainTex, poiMesh.uv[_LightingDetailShadowsUV], _LightingDetailShadowsPan), _LightingDetailStrength).r;
+ }
+
+ float3 realisticLighting = calculateRealisticLighting(finalColor, detailShadow).rgb;
+ finalLighting = lerp(realisticLighting, dot(realisticLighting, float3(0.299, 0.587, 0.114)), _LightingMonochromatic);
+ }
+ break;
+ case 3: // Skin
+
+ {
+ float subsurfaceShadowWeight = 0.0h;
+ float3 ambientNormalWorld = poiMesh.normals[1];//aTangentToWorld(s, s.blurredNormalTangent);
+
+ // Scattering mask.
+ float subsurface = 1;
+ float skinScatteringMask = _SssWeight * saturate(1.0h / _SssMaskCutoff * subsurface);
+ float skinScattering = saturate(subsurface * _SssScale * 2 + _SssBias);
+
+ // Skin subsurface depth absorption tint.
+ // cf http://www.crytek.com/download/2014_03_25_CRYENGINE_GDC_Schultz.pdf pg 35
+ half3 absorption = exp((1.0h - subsurface) * _SssTransmissionAbsorption.rgb);
+
+ // Albedo scale for absorption assumes ~0.5 luminance for Caucasian skin.
+ absorption *= saturate(finalColor.rgb * 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.color, half3(0.2126h, 0.7152h, 0.0722h));
+ float4 sssLookupUv = float4(ndlBlur, skinScattering * lumi, 0.0f, 0.0f);
+ half3 sss = poiLight.lightMap * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ finalLighting = min(lerp(indirectLighting * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * directLighting), directLighting);
+ }
+ break;
+ case 4:
+ {
+ finalLighting = directLighting;
+ }
+ break;
+ }
+ #endif
+ return finalLighting;
+}
+
+
+void applyLighting(inout float4 finalColor, float3 finalLighting)
+{
+ #ifdef VERTEXLIGHT_ON
+ finalColor.rgb *= finalLighting + poiLight.vFinalLighting;
+ #else
+ //finalColor.rgb = blendSoftLight(finalColor.rgb, finalLighting);
+ //finalColor.rgb *= saturate(poiLight.directLighting);
+ finalColor.rgb *= finalLighting;
+ #endif
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiLighting.cginc.meta
new file mode 100644
index 00000000..7c935bd7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: be833b6d97385124b8b1cbbcf36275b6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMSDF.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMSDF.cginc
new file mode 100644
index 00000000..6339aab5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMSDF.cginc
@@ -0,0 +1,243 @@
+#ifndef POI_MSDF
+ #define POI_MSDF
+
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+
+ float4 _TextFPSColor;
+ half _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ half2 _TextFPSOffset;
+ half2 _TextFPSScale;
+ half _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ half _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ half2 _TextPositionOffset;
+ half2 _TextPositionScale;
+ half _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ half _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ half2 _TextTimeOffset;
+ half2 _TextTimeScale;
+ half _TextTimeRotation;
+
+ #define glyphWidth 0.0625
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+
+ float3 globalTextEmission;
+
+ half2 getAsciiCoordinate(float index)
+ {
+ return half2((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 float4 albedo, float2 uv)
+ {
+ float3 cameraPos = clamp(getCameraPosition(), -999, 999);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE: ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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);
+ half2 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(uv, startUV, endUV, 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ albedo.rgb = lerp(albedo.rgb, _TextPositionColor.rgb, opacity * _TextPositionColor.a);
+ globalTextEmission += _TextPositionColor.rgb * opacity * _TextPositionEmissionStrength;
+ }
+
+ void ApplyTimeText(inout float4 albedo, float2 uv)
+ {
+ float instanceTime = _Time.y;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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);
+ half2 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(uv, float2(startUV, 0), float2(endUV, 1), 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ albedo.rgb = lerp(albedo.rgb, _TextTimeColor.rgb, opacity * _TextTimeColor.a);
+ globalTextEmission += _TextTimeColor.rgb * opacity * _TextTimeEmissionStrength;
+ }
+
+ void ApplyFPSText(inout float4 albedo, float2 uv)
+ {
+ float smoothDeltaTime = clamp(unity_DeltaTime.w, 0, 999);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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);
+ half2 glyphPos = getAsciiCoordinate(fpsArray[currentCharacter]);
+ // 0.1428571 = 1/7 = 1 / totalCharacters
+ float startUV = 1 / totalCharacters * currentCharacter;
+ float endUV = 1 / totalCharacters * (currentCharacter + 1);
+
+ fixed4 textFPSPadding = _TextFPSPadding;
+ textFPSPadding *= 1 / totalCharacters;
+ uv = remapClamped(uv, float2(startUV, 0), float2(endUV, 1), 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ albedo.rgb = lerp(albedo.rgb, _TextFPSColor.rgb, opacity * _TextFPSColor.a);
+ globalTextEmission += _TextFPSColor.rgb * opacity * _TextFPSEmissionStrength;
+ }
+
+ void ApplyTextOverlayColor(inout float4 albedo, inout float3 textOverlayEmission)
+ {
+ globalTextEmission = 0;
+ half positionalOpacity = 0;
+ #ifdef EFFECT_BUMP
+ UNITY_BRANCH
+ if(_TextFPSEnabled)
+ {
+ ApplyFPSText(albedo, poiMesh.uv[_TextFPSUV]);
+ }
+ UNITY_BRANCH
+ if(_TextPositionEnabled)
+ {
+ ApplyPositionText(albedo, poiMesh.uv[_TextPositionUV]);
+ }
+ UNITY_BRANCH
+ if(_TextTimeEnabled)
+ {
+ ApplyTimeText(albedo, poiMesh.uv[_TextTimeUV]);
+ }
+
+ textOverlayEmission = globalTextEmission;
+ #endif
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMSDF.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMSDF.cginc.meta
new file mode 100644
index 00000000..7f40f268
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMSDF.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 39347a84f5d044c4d917618f2cad9661
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMacros.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMacros.cginc
new file mode 100644
index 00000000..60897dea
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMacros.cginc
@@ -0,0 +1,40 @@
+#ifndef POI_MACROS
+ #define POI_MACROS
+
+ #define POI_TEXTURE_NOSAMPLER(tex) Texture2D tex; float4 tex##_ST; float2 tex##Pan; uint tex##UV
+ #define POI_TEXTURE(tex) UNITY_DECLARE_TEX2D(tex##); float4 tex##_ST; float2 tex##Pan; uint tex##UV
+ #define POI_NORMAL_NOSAMPLER(tex) Texture2D tex; float4 tex##_ST; float2 tex##Pan; uint tex##UV; float tex##Scale
+
+ #define POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, TRANSFORM_TEX(uv, tex) + _Time.x * pan))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, TRANSFORM_TEX(uv, tex)))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, TRANSFORM_TEX(uv, tex) + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, TRANSFORM_TEX(uv, tex)))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, TRANSFORM_TEX(uv, tex)))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, TRANSFORM_TEX(uv, tex) + _Time.x * pan))
+
+ #ifdef POINT
+ # define POI_LIGHT_ATTENUATION(destName, shadow, input, worldPos) \
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1)).xyz; \
+ fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \
+ fixed destName = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ #if !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS)
+ #define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(worldPos, 1))
+ #else
+ #define DECLARE_LIGHT_COORD(input, worldPos) unityShadowCoord4 lightCoord = input._LightCoord
+ #endif
+ # define POI_LIGHT_ATTENUATION(destName, shadow, input, worldPos) \
+ DECLARE_LIGHT_COORD(input, worldPos); \
+ fixed shadow = UNITY_SHADOW_ATTENUATION(input, worldPos); \
+ fixed destName = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+
+ #if defined(UNITY_COMPILER_HLSL)
+ #define PoiInitStruct(type,name) name = (type)0;
+ #else
+ #define PoiInitStruct(type,name)
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMacros.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMacros.cginc.meta
new file mode 100644
index 00000000..a9486762
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMacros.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6e064571b72c98948b7726439d667d07
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMainTex.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMainTex.cginc
new file mode 100644
index 00000000..6c01d499
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMainTex.cginc
@@ -0,0 +1,192 @@
+#ifndef POI_MAINTEXTURE
+#define POI_MAINTEXTURE
+
+
+#if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_ClippingMask);
+#endif
+#if defined(PROP_MAINFADETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MainFadeTexture);
+#endif
+
+float _Inverse_Clipping;
+float4 _Color;
+float _MainVertexColoring;
+float _MainVertexColoringLinearSpace;
+float _MainUseVertexColorAlpha;
+float _Saturation;
+float _MainDistanceFadeMin;
+float _MainDistanceFadeMax;
+half _MainMinAlpha;
+half _MainMaxAlpha;
+float _MainHueShift;
+float _MainFadeType;
+#ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MainColorAdjustTexture);
+ #endif
+ float _MainHueShiftToggle;
+ float _MainHueShiftSpeed;
+ float _MainHueShiftReplace;
+ float _MainSaturationShift;
+ float _MainBrightness;
+#endif
+
+#ifdef FINALPASS
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DetailTex);
+ #endif
+ half _DetailTexIntensity;
+ half3 _DetailTint;
+ float _DetailBrightness;
+#endif
+//globals
+float alphaMask;
+half3 diffColor;
+
+#include "CGI_PoiBackFace.cginc"
+
+float3 wireframeEmission;
+
+inline FragmentCommonData SpecularSetup(float4 i_tex, inout float4 albedo)
+{
+ half4 specGloss = 0;
+ half3 specColor = specGloss.rgb;
+ half smoothness = specGloss.a;
+
+ half oneMinusReflectivity;
+ diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo.rgb, specColor, /*out*/ oneMinusReflectivity);
+
+ FragmentCommonData o = (FragmentCommonData)0;
+ o.diffColor = diffColor;
+ o.specColor = specColor;
+ o.oneMinusReflectivity = oneMinusReflectivity;
+ o.smoothness = smoothness;
+ return o;
+}
+
+inline FragmentCommonData FragmentSetup(float4 i_tex, half3 i_viewDirForParallax, float3 i_posWorld, inout float4 albedo)
+{
+ i_tex = i_tex;
+
+ FragmentCommonData o = SpecularSetup(i_tex, albedo);
+ o.normalWorld = float3(0, 0, 0);
+ o.eyeVec = poiCam.viewDir;
+ o.posWorld = i_posWorld;
+
+ // NOTE: shader relies on pre-multiply alpha-blend (_SrcBlend = One, _DstBlend = OneMinusSrcAlpha)
+ o.diffColor = PreMultiplyAlpha(o.diffColor, 1, o.oneMinusReflectivity, /*out*/ o.alpha);
+ return o;
+}
+
+void initTextureData(inout float4 albedo, inout float4 mainTexture, inout float3 backFaceEmission, inout float3 dissolveEmission, in half3 detailMask)
+{
+ dissolveEmission = 0;
+
+ #if (defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #ifdef POI_MIRROR
+ applyMirrorTexture(mainTexture);
+ #endif
+ #endif
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiMesh.uv[_ClippingMaskUV], _ClippingMaskPan).r;
+ #else
+ alphaMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ mainTexture.a *= alphaMask;
+
+ #ifndef POI_SHADOW
+ float3 vertexColor = poiMesh.vertexColor.rgb;
+ UNITY_BRANCH
+ if(_MainVertexColoringLinearSpace)
+ {
+ vertexColor = GammaToLinearSpace(poiMesh.vertexColor.rgb);
+ }
+
+ albedo = float4(mainTexture.rgb * max(_Color.rgb, float3(0.000000001, 0.000000001, 0.000000001)) * lerp(1, vertexColor, _MainVertexColoring), mainTexture.a * max(_Color.a, 0.0000001));
+
+ #if defined(POI_LIGHTING) && defined(FORWARD_BASE_PASS)
+ applyShadeMaps(albedo);
+ #endif
+
+ albedo *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ #ifdef POI_RGBMASK
+ albedo.rgb = calculateRGBMask(albedo.rgb);
+ #endif
+
+ albedo.a = saturate(_AlphaMod + albedo.a);
+
+ wireframeEmission = 0;
+ #ifdef POI_WIREFRAME
+ applyWireframe(wireframeEmission, albedo);
+ #endif
+ float backFaceDetailIntensity = 1;
+
+ float mixedHueShift = _MainHueShift;
+ applyBackFaceTexture(backFaceDetailIntensity, mixedHueShift, albedo, backFaceEmission);
+
+ #ifdef POI_FUR
+ calculateFur();
+ #endif
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftReplace)
+ {
+ albedo.rgb = lerp(albedo.rgb, hueShift(albedo.rgb, mixedHueShift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ albedo.rgb = hueShift(albedo.rgb, frac((mixedHueShift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+
+ albedo.rgb = lerp(albedo.rgb, dot(albedo.rgb, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ albedo.rgb = saturate(albedo.rgb + _MainBrightness * hueShiftAlpha.g);
+ #endif
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiMesh.uv[_DetailTexUV], _DetailTexPan).rgb * _DetailTint.rgb;
+ #else
+ half3 detailTexture = 0.21763764082 * _DetailTint.rgb;
+ #endif
+ albedo.rgb *= LerpWhiteTo(detailTexture * _DetailBrightness * unity_ColorSpaceDouble.rgb, detailMask.r * _DetailTexIntensity * backFaceDetailIntensity);
+ #endif
+ albedo.rgb = saturate(albedo.rgb);
+
+ #ifdef POI_HOLOGRAM
+ ApplyHoloAlpha(albedo);
+ #endif
+
+ s = FragmentSetup(float4(poiMesh.uv[0], 1, 1), poiCam.viewDir, poiMesh.worldPos, albedo);
+ #endif
+
+ #ifdef DISTORT
+ calculateDissolve(albedo, dissolveEmission);
+ #endif
+}
+
+void distanceFade(inout float4 albedo)
+{
+ #if defined(PROP_MAINFADETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ half fadeMap = POI2D_SAMPLER_PAN(_MainFadeTexture, _MainTex, poiMesh.uv[_MainFadeTextureUV], _MainFadeTexturePan).r;
+ #else
+ half fadeMap = 1;
+ #endif
+ if (fadeMap)
+ {
+ float fadeDistance = _MainFadeType ? poiCam.distanceToVert : poiCam.distanceToModel;
+ half fadeValue = lerp(_MainMinAlpha, _MainMaxAlpha, smoothstep(_MainDistanceFadeMin, _MainDistanceFadeMax, fadeDistance));
+ albedo.a *= fadeValue;
+ }
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMainTex.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMainTex.cginc.meta
new file mode 100644
index 00000000..7684dca0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMainTex.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 543c4fafdae39c64ebbb99654c35c4b6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMatcap.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMatcap.cginc
new file mode 100644
index 00000000..5d7d0f73
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMatcap.cginc
@@ -0,0 +1,160 @@
+#ifndef MATCAP
+ #define MATCAP
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap); float4 _Matcap_ST;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MatcapMask);
+ #endif
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_Matcap2);float4 _Matcap2_ST;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_Matcap2Mask);
+ #endif
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ void blendMatcap(inout float4 finalColor, float add, float multiply, float replace, float4 matcapColor, float matcapMask, inout float3 matcapEmission, float emissionStrength
+ #ifdef POI_LIGHTING
+ , float matcapLightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ #ifdef POI_LIGHTING
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #endif
+ #ifdef POI_BLACKLIGHT
+ if(blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #endif
+
+ finalColor.rgb = lerp(finalColor.rgb, matcapColor.rgb, replace * matcapMask * matcapColor.a * .999999);
+ finalColor.rgb *= lerp(1, matcapColor.rgb, multiply * matcapMask * matcapColor.a);
+ finalColor.rgb += matcapColor.rgb * add * matcapMask * matcapColor.a;
+ matcapEmission += matcapColor.rgb * emissionStrength * matcapMask * matcapColor.a;
+ }
+
+ void applyMatcap(inout float4 finalColor, inout float3 matcapEmission)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+
+ // Both matcaps use the same coordinates
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+
+ // Matcap 1
+ half2 matcapUV = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * _MatcapColor;
+ #else
+ matcap = _MatcapColor;
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiMesh.uv[_MatcapMaskUV], _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ UNITY_BRANCH
+ if(_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(finalColor, _MatcapAdd, _MatcapMultiply, _MatcapReplace, matcap, matcapMask, matcapEmission, _MatcapEmissionStrength
+ #ifdef POI_LIGHTING
+ , _MatcapLightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+ half2 matcapUV2 = half2(dot(worldViewRight, poiMesh.normals[_Matcap2Normal]), dot(worldViewUp, poiMesh.normals[_Matcap2Normal])) * _Matcap2Border + 0.5;
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV2, _Matcap2)) * _Matcap2Color;
+ #else
+ matcap2 = _Matcap2Color;
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiMesh.uv[_Matcap2MaskUV], _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ UNITY_BRANCH
+ if(_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(finalColor, _Matcap2Add, _Matcap2Multiply, _Matcap2Replace, matcap2, matcap2Mask, matcapEmission, _Matcap2EmissionStrength
+ #ifdef POI_LIGHTING
+ , _Matcap2LightMask
+ #endif
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMatcap.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMatcap.cginc.meta
new file mode 100644
index 00000000..34077054
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMatcap.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ea56da5c525e5e441bf82593f3151cac
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMath.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMath.cginc
new file mode 100644
index 00000000..e81ff2d5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMath.cginc
@@ -0,0 +1,100 @@
+/*
+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
+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.
+
+VertexTransformShader is dependent on:
+*/
+
+#ifndef POI_MATH
+#define POI_MATH
+
+#ifndef pi
+ #define pi float(3.14159265359)
+#endif
+
+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)
+{
+ return float4(
+ cos(angle / 2.0),
+ normalize(axis) * sin(angle / 2.0)
+ );
+}
+
+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), degree_to_radius(rotation.x));
+ float4 qy = get_quaternion_from_angle(float3(0, 1, 0), degree_to_radius(rotation.y));
+ float4 qz = get_quaternion_from_angle(float3(0, 0, 1), degree_to_radius(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;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMath.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMath.cginc.meta
new file mode 100644
index 00000000..e5c6ac94
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMath.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 382dd34f82ef0a742b5bb3e691f224f6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMetal.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMetal.cginc
new file mode 100644
index 00000000..ed6b64ed
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMetal.cginc
@@ -0,0 +1,130 @@
+#ifndef POI_METAL
+ #define POI_METAL
+
+ samplerCUBE _CubeMap;
+ float _SampleWorld;
+ POI_TEXTURE_NOSAMPLER(_MetallicMask);
+ POI_TEXTURE_NOSAMPLER(_SmoothnessMask);
+ float _Metallic;
+ float _InvertSmoothness;
+ float _Smoothness;
+ float _EnableMetallic;
+ float3 _MetalReflectionTint;
+ POI_TEXTURE_NOSAMPLER(_MetallicTintMap);
+
+ float3 finalreflections;
+ float metalicMap;
+ float3 reflection;
+ float roughness;
+ float lighty_boy_uwu_var;
+
+ bool shouldMetalHappenBeforeLighting()
+ {
+ float4 envSample = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, poiCam.reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ bool probeExists = !(unity_SpecCube0_HDR.a == 0 && envSample.a == 0);
+ return probeExists && !_SampleWorld;
+ }
+
+ float3 fresnelRelflection(in float4 albedo)
+ {
+ half3 dotNV = 1 - abs(poiLight.nDotV);
+ half f = dotNV * dotNV * dotNV * dotNV;
+ //f *= i_sold.fresnel;
+ return lerp(lerp(DielectricSpec.rgb, albedo.rgb, metalicMap), saturate(1 - roughness + metalicMap), f);
+ }
+
+ void calculateMetallicness()
+ {
+ metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[_MetallicMaskUV], _MetallicMaskPan) * _Metallic;
+ }
+
+ void ApplyMetallics(inout float4 finalColor, in float4 albedo)
+ {
+ #ifdef FORWARD_BASE_PASS
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[_SmoothnessMaskUV], _SmoothnessMaskPan));
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskMetallic != 4)
+ {
+ metalicMap *= blackLightMask[_BlackLightMaskMetallic];
+ smoothnessMap *= blackLightMask[_BlackLightMaskMetallic];
+ }
+ #endif
+
+ if(_InvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _Smoothness;
+ roughness = 1 - smoothnessMap;
+
+
+ Unity_GlossyEnvironmentData envData;
+ envData.roughness = roughness;
+ envData.reflUVW = BoxProjection(
+ poiCam.reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube0_ProbePosition,
+ unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax
+ );
+ float3 probe0 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE(unity_SpecCube0), unity_SpecCube0_HDR, envData
+ );
+ envData.reflUVW = BoxProjection(
+ poiCam.reflectionDir, poiMesh.worldPos.xyz,
+ unity_SpecCube1_ProbePosition,
+ unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax
+ );
+
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if(interpolator < 0.99999)
+ {
+ float3 probe1 = Unity_GlossyEnvironment(
+ UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0),
+ unity_SpecCube0_HDR, envData
+ );
+ reflection = lerp(probe1, probe0, interpolator);
+ }
+ else
+ {
+ reflection = probe0;
+ }
+
+ float reflecty_lighty_boy_uwu_var_2 = 1.0 / (roughness * roughness + 1.0);
+
+ half4 tintMap = POI2D_SAMPLER_PAN(_MetallicTintMap, _MainTex, poiMesh.uv[_MetallicTintMapUV], _MetallicTintMapPan);
+ finalColor.rgb *= (1 - metalicMap * tintMap.a);
+ finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection(albedo) * _MetalReflectionTint * tintMap.rgb * tintMap.a;
+ #endif
+ }
+
+ void ApplyMetallicsFake(inout float4 finalColor, in float4 albedo)
+ {
+ #ifdef FORWARD_BASE_PASS
+ metalicMap = POI2D_SAMPLER_PAN(_MetallicMask, _MainTex, poiMesh.uv[_MetallicMaskUV], _MetallicMaskPan) * _Metallic;
+ float smoothnessMap = (POI2D_SAMPLER_PAN(_SmoothnessMask, _MainTex, poiMesh.uv[_SmoothnessMaskUV], _SmoothnessMaskPan));
+
+ #ifdef POI_BLACKLIGHT
+ if(_BlackLightMaskMetallic != 4)
+ {
+ metalicMap *= blackLightMask[_BlackLightMaskMetallic];
+ smoothnessMap *= blackLightMask[_BlackLightMaskMetallic];
+ }
+ #endif
+
+ if(_InvertSmoothness == 1)
+ {
+ smoothnessMap = 1 - smoothnessMap;
+ }
+ smoothnessMap *= _Smoothness;
+ roughness = 1 - smoothnessMap;
+
+ reflection = texCUBElod(_CubeMap, float4(poiCam.reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+
+ float reflecty_lighty_boy_uwu_var_2 = 1.0 / (roughness * roughness + 1.0);
+ half4 tintMap = POI2D_SAMPLER_PAN(_MetallicTintMap, _MainTex, poiMesh.uv[_MetallicTintMapUV], _MetallicTintMapPan);
+ finalColor.rgb *= (1 - metalicMap * tintMap.a);
+ finalColor.rgb += reflecty_lighty_boy_uwu_var_2 * reflection.rgb * fresnelRelflection(albedo) * _MetalReflectionTint * tintMap.rgb * tintMap.a;
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMetal.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMetal.cginc.meta
new file mode 100644
index 00000000..22f650ab
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMetal.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ef435eef1f3062442a396ae471e4c023
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMirror.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMirror.cginc
new file mode 100644
index 00000000..b2edec92
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMirror.cginc
@@ -0,0 +1,81 @@
+#ifndef POI_MIRROR
+ #define POI_MIRROR
+
+ float _Mirror;
+ float _EnableMirrorTexture;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MirrorTexture);
+ #endif
+
+
+ void applyMirrorRenderVert(inout float4 vertex)
+ {
+ UNITY_BRANCH
+ if (_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ vertex = -1;
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ void applyMirrorRenderFrag()
+ {
+ UNITY_BRANCH
+ if(_Mirror != 0)
+ {
+ bool inMirror = IsInMirror();
+ if(_Mirror == 1 && inMirror)
+ {
+ return;
+ }
+ if(_Mirror == 1 && !inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && inMirror)
+ {
+ clip(-1);
+ return;
+ }
+ if(_Mirror == 2 && !inMirror)
+ {
+ return;
+ }
+ }
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ void applyMirrorTexture(inout float4 mainTexture)
+ {
+ UNITY_BRANCH
+ if(_EnableMirrorTexture)
+ {
+ if(IsInMirror())
+ {
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ mainTexture = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ #endif
+ }
+ }
+ }
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMirror.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMirror.cginc.meta
new file mode 100644
index 00000000..790d2641
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiMirror.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6a90225807e1d2943a87f41b64493968
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineFrag.cginc
new file mode 100644
index 00000000..1db932e5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineFrag.cginc
@@ -0,0 +1,117 @@
+float _OutlineRimLightBlend;
+float _OutlineLit;
+float _OutlineTintMix;
+float2 _MainTexPan;
+float _MainTextureUV;
+half _OutlineHueOffset;
+half _OutlineHueShift;
+half _OutlineHueOffsetSpeed;
+
+float4 frag(v2f i, uint facing: SV_IsFrontFace): COLOR
+{
+ float4 finalColor = 1;
+ UNITY_BRANCH
+ if (_commentIfZero_EnableOutlinePass)
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+
+ float3 finalEmission = 0;
+ float4 albedo = 1;
+
+ poiMesh.uv[0] = i.uv0.xy;
+ poiMesh.uv[1] = i.uv0.zw;
+ poiMesh.uv[2] = i.uv1.xy;
+ poiMesh.uv[3] = i.uv1.zw;
+
+ calculateAttenuation(i);
+ InitializeMeshData(i, facing);
+ initializeCamera(i);
+ calculateTangentData();
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[_MainTextureUV], _MainTex) + _Time.x * _MainTexPan);
+ half3 detailMask = 1;
+ calculateNormals(detailMask);
+
+ #ifdef POI_DATA
+ calculateLightingData(i);
+ #endif
+ #ifdef POI_LIGHTING
+ calculateBasePassLightMaps();
+ #endif
+
+ float3 uselessData0;
+ float3 uselessData1;
+ initTextureData(albedo, mainTexture, uselessData0, uselessData1, detailMask);
+
+
+ fixed4 col = mainTexture;
+ float alphaMultiplier = smoothstep(_OutlineFadeDistance.x, _OutlineFadeDistance.y, distance(getCameraPosition(), i.worldPos));
+ float OutlineMask = tex2D(_OutlineMask, TRANSFORM_TEX(poiMesh.uv[_OutlineMaskUV], _OutlineMask) + _Time.x * _OutlineMaskPan).r;
+ clip(OutlineMask * _LineWidth - 0.001);
+
+ col = col * 0.00000000001 + tex2D(_OutlineTexture, TRANSFORM_TEX(poiMesh.uv[_OutlineTextureUV], _OutlineTexture) + _Time.x * _OutlineTexturePan);
+ col.a *= albedo.a;
+ col.a *= alphaMultiplier;
+
+ #ifdef POI_RANDOM
+ col.a *= i.angleAlpha;
+ #endif
+
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ col.a *= _LineColor.a;
+
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ applyDithering(col);
+ }
+
+ clip(col.a - _Cutoff);
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderFrag();
+ #endif
+
+ UNITY_BRANCH
+ if (_OutlineMode == 1)
+ {
+ #ifdef POI_MIRROR
+ applyMirrorTexture(mainTexture);
+ #endif
+ col.rgb = mainTexture.rgb;
+ }
+ else if (_OutlineMode == 2)
+ {
+ col.rgb = lerp(col.rgb, poiLight.color, _OutlineRimLightBlend);
+ }
+ col.rgb *= _LineColor.rgb;
+
+ if (_OutlineMode == 1)
+ {
+ col.rgb = lerp(col.rgb, mainTexture.rgb, _OutlineTintMix);
+ }
+
+ finalColor = col;
+
+ // Hue shift
+ UNITY_BRANCH
+ if (_OutlineHueShift)
+ {
+ finalColor.rgb = hueShift(finalColor.rgb, _OutlineHueOffset + _OutlineHueOffsetSpeed * _Time.x);
+ }
+
+ #ifdef POI_LIGHTING
+ UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ finalColor.rgb *= calculateFinalLighting(finalColor.rgb, finalColor);
+ }
+ #endif
+ finalColor.rgb += (col.rgb * _OutlineEmission);
+}
+else
+{
+ clip(-1);
+}
+return finalColor;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineFrag.cginc.meta
new file mode 100644
index 00000000..c0544bc2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7db374de8ad35a74e8b931bcef6e3ba8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineVert.cginc
new file mode 100644
index 00000000..55fb800d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineVert.cginc
@@ -0,0 +1,144 @@
+#ifndef OutlineVert
+#define OutlineVert
+
+#include "CGI_PoiV2F.cginc"
+
+float _OutlineMode;
+float4 _OutlinePersonaDirection;
+float4 _OutlineDropShadowOffset;
+float _OutlineUseVertexColors;
+float _OutlineFixedSize;
+float _commentIfZero_EnableOutlinePass;
+float _OutlinesMaxDistance;
+
+sampler2D _OutlineMask; float4 _OutlineMask_ST; float2 _OutlineMaskPan; float _OutlineMaskUV;
+
+float _VertexManipulationHeightUV;
+
+float3 CreateBinormal(half3 normal, half3 tangent, half tangentSign)
+{
+ half sign = tangentSign * unity_WorldTransformParams.w;
+ return cross(normal, tangent) * sign;
+}
+
+v2f vert(appdata v)
+{
+
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+
+ #ifdef AUTO_EXPOSURE
+ applyLocalVertexTransformation(v.normal, v.tangent, v.vertex);
+ #endif
+
+ UNITY_INITIALIZE_OUTPUT(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicOrifaceSystem(v);
+ #endif
+
+ o.uv0.xy = v.uv0.xy;
+ o.uv0.zw = v.uv1.xy;
+ o.uv1.xy = v.uv2.xy;
+ o.uv1.zw = v.uv3.xy;
+
+ float2 uvArray[4];
+ uvArray[0] = o.uv0.xy;
+ uvArray[1] = o.uv0.zw;
+ uvArray[2] = o.uv1.xy;
+ uvArray[3] = o.uv1.zw;
+
+ float2 uvToUse = uvArray[_VertexManipulationHeightUV];
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderVert(v.vertex);
+ #endif
+
+ o.uv0.xy = v.uv0 + _OutlineGlobalPan.xy * _Time.y;
+ float outlineMask = 1;
+
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(TRANSFORM_TEX(uvArray[_OutlineMaskUV], _OutlineMask) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+ UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ UNITY_BRANCH
+ if (_OutlineUseVertexColors != 1)
+ {
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ }
+ else
+ {
+ o.normal = UnityObjectToWorldNormal(v.color);
+ }
+
+ float4 localPos = v.vertex;
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicPenetrationSystem(localPos.rgb, o.normal.rgb, v);
+ #endif
+ o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
+ o.binormal.rgb = CreateBinormal(o.normal.xyz, o.tangent.xyz, o.tangent.w);
+
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = o.normal * (_LineWidth * _commentIfZero_EnableOutlinePass / 100) * outlineMask * distanceOffset;
+
+ UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = poiLight.direction = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, o.normal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, o.normal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+
+ o.worldPos = mul(unity_ObjectToWorld, localPos) + float4(offset, 0);
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+
+ #ifdef AUTO_EXPOSURE
+ applyWorldVertexTransformation(o.worldPos, o.localPos, o.normal, uvToUse);
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ applyVertexRounding(o.worldPos, o.localPos);
+ #endif
+
+ o.pos = UnityWorldToClipPos(o.worldPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.angleAlpha = 1;
+ #ifdef POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+
+ UNITY_TRANSFER_SHADOW(o, o.uv0);
+ UNITY_TRANSFER_FOG(o, o.pos);
+ return o;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineVert.cginc.meta
new file mode 100644
index 00000000..9de9fef6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiOutlineVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3ffaf29d05947a14fa6c536ce06612d5
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPanosphere.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPanosphere.cginc
new file mode 100644
index 00000000..7986c320
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPanosphere.cginc
@@ -0,0 +1,80 @@
+#ifndef PANOSPHERE
+ #define PANOSPHERE
+
+ float _PanoEmission;
+ float _PanoBlend;
+ float4 _PanosphereColor;
+ float3 _PanospherePan;
+ float _PanoToggle;
+ float _PanoCubeMapToggle;
+ float _PanoInfiniteStereoToggle;
+
+ float3 panoColor;
+ float panoMask;
+
+ #if defined(PROP_PANOSPHERETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ sampler2D _PanosphereTexture; float4 _PanosphereTexture_ST;
+ #endif
+ #if defined(PROP_PANOCUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _PanoCubeMap; half4 _PanoCubeMap_HDR;
+ #endif
+ #if defined(PROP_PANOMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_PanoMask);
+ #endif
+
+ float2 projectIt(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude + _Time.y * _PanospherePan.x, latitude + _Time.y * _PanospherePan.y) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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;
+ }
+
+ void applyPanosphereColor(inout float4 albedo, inout float3 panosphereEmission)
+ {
+ #if defined(PROP_PANOMASK) || !defined(OPTIMIZER_ENABLED)
+ panoMask = POI2D_SAMPLER_PAN(_PanoMask, _MainTex, poiMesh.uv[_PanoMaskUV], _PanoMaskPan);
+ #else
+ panoMask = 1;
+ #endif
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskPanosphere != 4)
+ {
+ panoMask *= blackLightMask[_BlackLightMaskPanosphere];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if(_PanoCubeMapToggle)
+ {
+ #if defined(PROP_PANOCUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float3 cubeUV = mul(poiRotationMatrixFromAngles(_PanospherePan.xyz * _Time.y), float4(-poiCam.viewDir, 1));
+ half4 cubemap = texCUBE(_PanoCubeMap, cubeUV);
+ panoColor = DecodeHDR(cubemap, _PanoCubeMap_HDR) * _PanosphereColor.rgb;
+ #else
+ panoColor = _PanosphereColor.rgb;
+ #endif
+ }
+ else
+ {
+ float2 uv = projectIt(normalize(lerp(getCameraPosition().xyz, poiCam.worldPos.xyz, _PanoInfiniteStereoToggle) - poiMesh.worldPos.xyz) * - 1);
+
+ float2 ddxuv = ddx(uv);
+ float2 ddyuv = ddy(uv);
+ if(any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ #if defined(PROP_PANOSPHERETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ panoColor = tex2D(_PanosphereTexture, TRANSFORM_TEX(uv, _PanosphereTexture), ddxuv, ddyuv).rgb * _PanosphereColor.rgb;
+ #else
+ panoColor = _PanosphereColor.rgb;
+ #endif
+ }
+ panosphereEmission = panoColor * _PanoBlend * panoMask * _PanoEmission;
+ albedo.rgb = lerp(albedo.rgb, panoColor, _PanoBlend * .9999999 * panoMask);
+ }
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPanosphere.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPanosphere.cginc.meta
new file mode 100644
index 00000000..aaebe97b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPanosphere.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1181a36e0475df340b0a8d40fc95f05b
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiParallax.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiParallax.cginc
new file mode 100644
index 00000000..db2f9da4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiParallax.cginc
@@ -0,0 +1,166 @@
+#ifndef POI_PARALLAX
+ #define POI_PARALLAX
+
+ #if defined(PROP_PARALLAXHEIGHTMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ParallaxHeightMap); float4 _ParallaxHeightMap_ST;
+ #endif
+ #if defined(PROP_PARALLAXHEIGHTMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_ParallaxHeightMapMask);
+ #endif
+ float2 _ParallaxHeightMapPan;
+ float _ParallaxStrength;
+ float _ParallaxHeightMapEnabled;
+ float _ParallaxUV;
+
+ //Internal
+ float _ParallaxInternalMapEnabled;
+ #if defined(PROP_PARALLAXINTERNALMAP) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_ParallaxInternalMap); float4 _ParallaxInternalMap_ST;
+ #endif
+ #if defined(PROP_PARALLAXINTERNALMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_ParallaxInternalMapMask);
+ #endif
+ float _ParallaxInternalIterations;
+ float _ParallaxInternalMinDepth;
+ float _ParallaxInternalMaxDepth;
+ float _ParallaxInternalMinFade;
+ float _ParallaxInternalMaxFade;
+ float4 _ParallaxInternalMinColor;
+ float4 _ParallaxInternalMaxColor;
+ float4 _ParallaxInternalPanSpeed;
+ float4 _ParallaxInternalPanDepthSpeed;
+ float _ParallaxInternalHeightmapMode;
+ float _ParallaxInternalHeightFromAlpha;
+
+ float GetParallaxHeight(float2 uv)
+ {
+ #if defined(PROP_PARALLAXHEIGHTMAP) || !defined(OPTIMIZER_ENABLED)
+ return clamp(UNITY_SAMPLE_TEX2D_SAMPLER(_ParallaxHeightMap, _MainTex, TRANSFORM_TEX(uv, _ParallaxHeightMap) + _Time.x * _ParallaxHeightMapPan).g, 0, .99999);
+ #else
+ return 0;
+ #endif
+ }
+ /*
+ float2 ParallaxOffset(float2 viewDir)
+ {
+ float height = GetParallaxHeight();
+ height -= 0.5;
+ height *= _ParallaxStrength;
+ return viewDir * height;
+ }
+ */
+ float2 ParallaxRaymarching(float2 viewDir)
+ {
+ float2 uvOffset = 0;
+ float stepSize = 0.1;
+ float2 uvDelta = viewDir * (stepSize * _ParallaxStrength);
+
+ float stepHeight = 1;
+ float surfaceHeight = GetParallaxHeight(poiMesh.uv[_ParallaxUV]);
+
+
+ float2 prevUVOffset = uvOffset;
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ for (int i = 1; i < 10 && stepHeight > surfaceHeight; i ++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ surfaceHeight = GetParallaxHeight(poiMesh.uv[_ParallaxUV] + uvOffset);
+ }
+
+ float prevDifference = prevStepHeight - prevSurfaceHeight;
+ float difference = surfaceHeight - stepHeight;
+ float t = prevDifference / (prevDifference + difference);
+ uvOffset = prevUVOffset -uvDelta * t;
+ #if defined(PROP_PARALLAXHEIGHTMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ return uvOffset *= POI2D_SAMPLER_PAN(_ParallaxHeightMapMask, _MainTex, poiMesh.uv[_ParallaxHeightMapMaskUV], _ParallaxHeightMapMaskPan).r;
+ #else
+ return uvOffset;
+ #endif
+ }
+
+ void calculateandApplyParallax()
+ {
+ UNITY_BRANCH
+ if (_ParallaxHeightMapEnabled)
+ {
+ float2 parallaxOffset = ParallaxRaymarching(poiCam.tangentViewDir.xy);
+ UNITY_BRANCH
+ if(_ParallaxUV == 0)
+ {
+ poiMesh.uv[0] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 1)
+ {
+ poiMesh.uv[1] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 2)
+ {
+ poiMesh.uv[2] += parallaxOffset;
+ }
+ UNITY_BRANCH
+ if(_ParallaxUV == 3)
+ {
+ poiMesh.uv[3] += parallaxOffset;
+ }
+ }
+ }
+
+ void calculateAndApplyInternalParallax(inout float4 finalColor)
+ {
+ #if defined(_PARALLAXMAP)
+ UNITY_BRANCH
+ if(_ParallaxInternalMapEnabled)
+ {
+ float3 parallax = 0;
+
+ for (int j = _ParallaxInternalIterations; j > 0; j --)
+ {
+ float ratio = (float)j / _ParallaxInternalIterations;
+ float2 parallaxOffset = _Time.y * (_ParallaxInternalPanSpeed + (1 - ratio) * _ParallaxInternalPanDepthSpeed);
+ float fade = lerp(_ParallaxInternalMinFade, _ParallaxInternalMaxFade, ratio);
+ #if defined(PROP_PARALLAXINTERNALMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 parallaxColor = UNITY_SAMPLE_TEX2D_SAMPLER(_ParallaxInternalMap, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _ParallaxInternalMap) + lerp(_ParallaxInternalMinDepth, _ParallaxInternalMaxDepth, ratio) * - poiCam.tangentViewDir.xy + parallaxOffset);
+ #else
+ float4 parallaxColor = 0;
+ #endif
+ float3 parallaxTint = lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, ratio);
+ float parallaxHeight;
+ if(_ParallaxInternalHeightFromAlpha)
+ {
+ parallaxTint *= parallaxColor.rgb;
+ parallaxHeight = parallaxColor.a;
+ }
+ else
+ {
+ parallaxHeight = parallaxColor.r;
+ }
+ //float parallaxColor *= lerp(_ParallaxInternalMinColor, _ParallaxInternalMaxColor, 1 - ratio);
+ UNITY_BRANCH
+ if (_ParallaxInternalHeightmapMode == 1)
+ {
+ parallax = lerp(parallax, parallaxTint * fade, parallaxHeight >= 1 - ratio);
+ }
+ else
+ {
+ parallax += parallaxTint * parallaxHeight * fade;
+ }
+ }
+ //parallax /= _ParallaxInternalIterations;
+ #if defined(PROP_PARALLAXINTERNALMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ finalColor.rgb += parallax * POI2D_SAMPLER_PAN(_ParallaxInternalMapMask, _MainTex, poiMesh.uv[_ParallaxInternalMapMaskUV], _ParallaxInternalMapMaskPan).r;
+ #else
+ finalColor.rgb += parallax;
+ #endif
+ }
+ #endif
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiParallax.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiParallax.cginc.meta
new file mode 100644
index 00000000..dfdd10cc
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiParallax.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3737980e09be8994e929a4a8aca17fd4
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPass.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPass.cginc
new file mode 100644
index 00000000..8b22cdd0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPass.cginc
@@ -0,0 +1,252 @@
+/*
+USED---------------------------------------------
+"_PARALLAXMAP"
+"_REQUIRE_UV2"
+"_SUNDISK_NONE"
+"_DETAIL_MULX2"
+"_GLOSSYREFLECTIONS_OFF"
+"_METALLICGLOSSMAP"
+"_COLORADDSUBDIFF_ON"
+"_SPECGLOSSMAP"
+"_TERRAIN_NORMAL_MAP"
+"_SUNDISK_SIMPLE"
+"_EMISSION"
+"_COLORCOLOR_ON"
+"_COLOROVERLAY_ON"
+"_ALPHAMODULATE_ON"
+"_SUNDISK_HIGH_QUALITY"
+"_MAPPING_6_FRAMES_LAYOUT"
+"_NORMALMAP
+"EFFECT_BUMP"
+"BLOOM"
+"BLOOM_LOW"
+"GRAIN"
+"DEPTH_OF_FIELD"
+"USER_LUT"
+"CHROMATIC_ABERRATION_LOW"
+"BLOOM_LENS_DIRT"
+"_FADING_ON"
+"CHROMATIC_ABERRATION"
+"DISTORT"
+"GEOM_TYPE_BRANCH"
+"_SPECULARHIGHLIGHTS_OFF"
+"_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A"
+"EFFECT_HUE_VARIATION"
+"GEOM_TYPE_LEAF"
+"GEOM_TYPE_MESH"
+"FINALPASS"
+"AUTO_EXPOSURE
+"VIGNETTE"
+"VIGNETTE_MASKED"
+"COLOR_GRADING_HDR"
+"COLOR_GRADING_HDR_3D"
+"DITHERING"
+"VIGNETTE_CLASSIC"
+"GEOM_TYPE_BRANCH_DETAIL"
+"GEOM_TYPE_FROND"
+"DEPTH_OF_FIELD_COC_VIEW"
+"COLOR_GRADING_LOG_VIEW"
+"TONEMAPPING_CUSTOM"
+
+UNUSED-------------------------------------------
+"_ALPHABLEND_ON"
+"_ALPHAPREMULTIPLY_ON"
+"_ALPHATEST_ON"
+"PIXELSNAP_ON"
+"TONEMAPPING_FILMIC"
+"TONEMAPPING_NEUTRAL"
+"TONEMAPPING_ACES"
+"COLOR_GRADING"
+
+DO NOT USE -----------------------------------------
+"BILLBOARD_FACE_CAMERA_POS"
+SOFTPARTICLES_ON
+*/
+
+
+#ifndef POI_PASS
+#define POI_PASS
+
+#include "UnityCG.cginc"
+#include "Lighting.cginc"
+#include "UnityPBSLighting.cginc"
+#include "AutoLight.cginc"
+#include "UnityShaderVariables.cginc"
+
+#ifdef POI_META_PASS
+ #include "UnityMetaPass.cginc"
+#endif
+
+//#pragma warning (default : 3206) // implicit truncation
+
+#include "CGI_PoiMacros.cginc"
+#include "CGI_PoiDefines.cginc"
+#include "CGI_FunctionsArtistic.cginc"
+
+#include "CGI_Poicludes.cginc"
+#include "CGI_PoiHelpers.cginc"
+#include "CGI_PoiBlending.cginc"
+
+#ifdef _SUNDISK_NONE
+ #include "CGI_PoiRandom.cginc"
+#endif
+
+#ifdef _REQUIRE_UV2
+ #include "CGI_PoiMirror.cginc"
+#endif
+
+#include "CGI_PoiPenetration.cginc"
+#include "CGI_PoiVertexManipulations.cginc"
+
+#include "CGI_PoiSpawnInVert.cginc"
+
+#include "CGI_PoiV2F.cginc"
+
+#ifdef BLOOM_LOW
+ #include "CGI_PoiBulge.cginc"
+#endif
+
+#include "CGI_PoiVert.cginc"
+
+#ifdef TESSELATION
+ #include "CGI_PoiTessellation.cginc"
+#endif
+
+#include "CGI_PoiDithering.cginc"
+
+#ifdef _PARALLAXMAP
+ #include "CGI_PoiParallax.cginc"
+#endif
+
+#ifdef COLOR_GRADING_LOG_VIEW
+ #include "CGI_PoiAudioLink.cginc"
+#endif
+
+#ifdef USER_LUT
+ #include "CGI_PoiUVDistortion.cginc"
+#endif
+
+#ifdef VIGNETTE
+ #include "CGI_PoiRGBMask.cginc"
+#endif
+
+#include "CGI_PoiData.cginc"
+
+#ifdef _SPECULARHIGHLIGHTS_OFF
+ #include "CGI_PoiBlackLight.cginc"
+#endif
+
+#include "CGI_PoiSpawnInFrag.cginc"
+
+#ifdef WIREFRAME
+ #include "CGI_PoiWireframe.cginc"
+#endif
+
+#ifdef DISTORT
+ #include "CGI_PoiDissolve.cginc"
+#endif
+
+#ifdef DEPTH_OF_FIELD
+ #include "CGI_PoiHologram.cginc"
+#endif
+
+#ifdef BLOOM_LENS_DIRT
+ #include "CGI_PoiIridescence.cginc"
+#endif
+
+
+#ifdef FUR
+ //#include "CGI_PoiFur.cginc"
+ //#include "CGI_PoiGeomFur.cginc"
+#endif
+
+#ifdef VIGNETTE_MASKED
+ #include "CGI_PoiLighting.cginc"
+#endif
+
+#include "CGI_PoiMainTex.cginc"
+
+#ifdef TONEMAPPING_CUSTOM
+ #include "CGI_PoiPathing.cginc"
+#endif
+
+#ifdef GEOM_TYPE_BRANCH
+ #include "CGI_PoiDecal.cginc"
+#endif
+
+#ifdef CHROMATIC_ABERRATION
+ #include "CGI_PoiVoronoi.cginc"
+#endif
+
+#ifdef _DETAIL_MULX2
+ #include "CGI_PoiPanosphere.cginc"
+#endif
+
+#ifdef EFFECT_BUMP
+ #include "CGI_PoiMSDF.cginc"
+#endif
+
+#ifdef GRAIN
+ #include "CGI_PoiDepthColor.cginc"
+#endif
+
+
+#ifdef _SUNDISK_HIGH_QUALITY
+ #include "CGI_PoiFlipbook.cginc"
+#endif
+
+#ifdef _GLOSSYREFLECTIONS_OFF
+ #include "CGI_PoiRimLighting.cginc"
+#endif
+
+#ifdef _MAPPING_6_FRAMES_LAYOUT
+ #include "CGI_PoiEnvironmentalRimLighting.cginc"
+#endif
+
+#ifdef VIGNETTE_CLASSIC
+ #include "CGI_PoiBRDF.cginc"
+#endif
+
+#ifdef _METALLICGLOSSMAP
+ #include "CGI_PoiMetal.cginc"
+#endif
+
+#ifdef _COLORADDSUBDIFF_ON
+ #include "CGI_PoiMatcap.cginc"
+#endif
+
+#ifdef _SPECGLOSSMAP
+ #include "CGI_PoiSpecular.cginc"
+#endif
+
+#ifdef BLOOM
+ #include "CGI_PoiVideo.cginc"
+#endif
+
+#ifdef _TERRAIN_NORMAL_MAP
+ #include "CGI_PoiSubsurfaceScattering.cginc"
+#endif
+
+#include "CGI_PoiBlending.cginc"
+#include "CGI_PoiGrab.cginc"
+
+#ifdef _SUNDISK_SIMPLE
+ #include "CGI_PoiGlitter.cginc"
+#endif
+
+#ifdef _EMISSION
+ #include "CGI_PoiEmission.cginc"
+#endif
+
+#ifdef _COLORCOLOR_ON
+ #include "CGI_PoiClearCoat.cginc"
+#endif
+
+#include "CGI_PoiAlphaToCoverage.cginc"
+
+#ifdef _COLOROVERLAY_ON
+ #include "CGI_PoiDebug.cginc"
+#endif
+#include "CGI_PoiFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPass.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPass.cginc.meta
new file mode 100644
index 00000000..e829717d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPass.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: fa1dff6cd1c9b9f4891de1a7c880523d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassOutline.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassOutline.cginc
new file mode 100644
index 00000000..f8504d25
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassOutline.cginc
@@ -0,0 +1,34 @@
+#ifndef POI_PASS_OUTLINE
+#define POI_PASS_OUTLINE
+
+#include "UnityCG.cginc"
+#include "Lighting.cginc"
+#include "UnityPBSLighting.cginc"
+#include "AutoLight.cginc"
+#include "CGI_PoiMacros.cginc"
+#include "CGI_PoiDefines.cginc"
+#include "CGI_FunctionsArtistic.cginc"
+#include "CGI_Poicludes.cginc"
+#include "CGI_PoiHelpers.cginc"
+#include "CGI_PoiBlending.cginc"
+#include "CGI_PoiPenetration.cginc"
+#include "CGI_PoiVertexManipulations.cginc"
+#include "CGI_PoiOutlineVert.cginc"
+#ifdef TESSELATION
+ #include "CGI_PoiTessellation.cginc"
+#endif
+#ifdef _REQUIRE_UV2
+ #include "CGI_PoiMirror.cginc"
+#endif
+#ifdef DISTORT
+ #include "CGI_PoiDissolve.cginc"
+#endif
+#include "CGI_PoiLighting.cginc"
+#include "CGI_PoiMainTex.cginc"
+#include "CGI_PoiData.cginc"
+#include "CGI_PoiDithering.cginc"
+#ifdef _COLOROVERLAY_ON
+ #include "CGI_PoiDebug.cginc"
+#endif
+#include "CGI_PoiOutlineFrag.cginc"
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassOutline.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassOutline.cginc.meta
new file mode 100644
index 00000000..b3bd3e2a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassOutline.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0fe97530a72193b4faea2c5e3dd997a6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassShadow.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassShadow.cginc
new file mode 100644
index 00000000..9e5c4fea
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassShadow.cginc
@@ -0,0 +1,46 @@
+#ifndef POI_PASS_SHADOW
+ #define POI_PASS_SHADOW
+
+ #pragma multi_compile_shadowcaster
+ #include "UnityCG.cginc"
+ #include "UnityShaderVariables.cginc"
+ #include "UnityCG.cginc"
+ #include "Lighting.cginc"
+ #include "UnityPBSLighting.cginc"
+ #include "AutoLight.cginc"
+
+ #include "CGI_PoiMacros.cginc"
+ #include "CGI_PoiDefines.cginc"
+
+ #include "CGI_Poicludes.cginc"
+ #include "CGI_PoiShadowIncludes.cginc"
+ #include "CGI_PoiHelpers.cginc"
+ #include "CGI_PoiMirror.cginc"
+ #include "CGI_PoiSpawnInFrag.cginc"
+
+ #include "CGI_PoiV2F.cginc"
+ #include "CGI_PoiData.cginc"
+
+ #ifdef WIREFRAME
+ #include "CGI_PoiWireframe.cginc"
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ #include "CGI_PoiFlipbook.cginc"
+ #endif
+
+ #ifdef _SUNDISK_NONE
+ #include "CGI_PoiRandom.cginc"
+ #endif
+ #include "CGI_PoiDithering.cginc"
+ #ifdef DISTORT
+ #include "CGI_PoiDissolve.cginc"
+ #endif
+ #include "CGI_PoiPenetration.cginc"
+ #include "CGI_PoiVertexManipulations.cginc"
+
+ #include "CGI_PoiSpawnInVert.cginc"
+ #include "CGI_PoiShadowVert.cginc"
+ #include "CGI_PoiShadowFrag.cginc"
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassShadow.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassShadow.cginc.meta
new file mode 100644
index 00000000..239a4e9a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPassShadow.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 94f93700d2c2f3946ba884cd83881c8e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPathing.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPathing.cginc
new file mode 100644
index 00000000..b35f402e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPathing.cginc
@@ -0,0 +1,150 @@
+#ifndef POI_PATHING
+#define POI_PATHING
+
+// Fill, 0, Path, 1, Loop, 2
+half _PathTypeR;
+half _PathTypeG;
+half _PathTypeB;
+half3 _PathWidth;
+float3 _PathTime;
+float3 _PathOffset;
+float3 _PathSpeed;
+float4 _PathColorR;
+float4 _PathColorG;
+float4 _PathColorB;
+float3 _PathEmissionStrength;
+float3 _PathSoftness;
+float3 _PathSegments;
+float3 _PathAlpha;
+
+#ifdef POI_AUDIOLINK
+ // Time Offset
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+
+ // Emission Offset
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+
+ // Length Offset
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+#endif
+
+#if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_PathingMap);
+#endif
+#if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_PathingColorMap);
+#endif
+
+void applyPathing(inout float4 albedo, inout float3 pathEmission)
+{
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = POI2D_SAMPLER_PAN(_PathingMap, _MainTex, poiMesh.uv[_PathingMapUV], _PathingMapPan);
+ #else
+ float4 path = float4(0,0,0,0);
+ return;
+ #endif
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 pathColorMap = POI2D_SAMPLER_PAN(_PathingColorMap, _MainTex, poiMesh.uv[_PathingColorMapUV], _PathingColorMapPan);
+ #else
+ float4 pathColorMap = float4(1, 1, 1, 1);
+ #endif
+
+ float3 pathAudioLinkEmission = 0;
+ float3 pathTime = 0;
+ float3 pathAlpha[3] = {
+ float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0)
+ };
+
+
+ #ifdef POI_AUDIOLINK
+ half pathAudioLinkPathTimeOffsetBand[3] = {_AudioLinkPathTimeOffsetBandR, _AudioLinkPathTimeOffsetBandG, _AudioLinkPathTimeOffsetBandB};
+ half2 pathAudioLinkTimeOffset[3] = {_AudioLinkPathTimeOffsetR.xy, _AudioLinkPathTimeOffsetG.xy, _AudioLinkPathTimeOffsetB.xy};
+ half pathAudioLinkPathWidthOffsetBand[3] = {_AudioLinkPathWidthOffsetBandR, _AudioLinkPathWidthOffsetBandG, _AudioLinkPathWidthOffsetBandB};
+ half2 pathAudioLinkWidthOffset[3] = {_AudioLinkPathWidthOffsetR.xy, _AudioLinkPathWidthOffsetG.xy, _AudioLinkPathWidthOffsetB.xy};
+
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ // Emission
+ pathAudioLinkEmission.r = lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g = lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b = lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 3; index++)
+ {
+ pathTime[index] = _PathTime[index] != -999.0f ? frac(_PathTime[index] + _PathOffset[index]): frac(_Time.x * _PathSpeed[index] + _PathOffset[index]);
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ pathTime[index] += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+ #endif
+
+ 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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ #endif
+
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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]);
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * _PathColorR.rgb * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * _PathColorG.rgb * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ pathEmission += pathAlpha[2][_PathTypeB] * _PathColorB.rgb * (_PathEmissionStrength[2] + pathAudioLinkEmission.b);
+ pathEmission *= pathColorMap.rgb * pathColorMap.a * path.a;
+
+ float3 colorReplace = 0;
+ colorReplace = pathAlpha[0][_PathTypeR] * _PathColorR.rgb * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * path.a * _PathColorR.a * pathAlpha[0][_PathTypeR]);
+ colorReplace = pathAlpha[1][_PathTypeG] * _PathColorG.rgb * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * path.a * _PathColorG.a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * _PathColorB.rgb * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * path.a * _PathColorB.a * pathAlpha[2][_PathTypeB]);
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPathing.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPathing.cginc.meta
new file mode 100644
index 00000000..e0413910
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPathing.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3649a270ab312624fb813bdd56cf2373
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPenetration.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPenetration.cginc
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPenetration.cginc
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPenetration.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPenetration.cginc.meta
new file mode 100644
index 00000000..d25df48e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiPenetration.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4c432851cf0d1dd44b21e0713429604a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRGBMask.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRGBMask.cginc
new file mode 100644
index 00000000..7a92e7b7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRGBMask.cginc
@@ -0,0 +1,191 @@
+#ifndef POI_RGBMASK
+ #define POI_RGBMASK
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RGBMask); float4 _RGBMask_ST;
+ #endif
+ #if defined(PROP_REDTEXURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_RedTexure); float4 _RedTexure_ST;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_GreenTexture); float4 _GreenTexture_ST;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_BlueTexture); float4 _BlueTexture_ST;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_AlphaTexture); float4 _AlphaTexture_ST;
+ #endif
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ POI_NORMAL_NOSAMPLER(_RgbNormalR);
+ POI_NORMAL_NOSAMPLER(_RgbNormalG);
+ POI_NORMAL_NOSAMPLER(_RgbNormalB);
+ POI_NORMAL_NOSAMPLER(_RgbNormalA);
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float2 _RGBMaskPanning;
+ float2 _RGBRedPanning;
+ float2 _RGBGreenPanning;
+ float2 _RGBBluePanning;
+ float2 _RGBAlphaPanning;
+
+ float _RGBBlendMultiplicative;
+
+ float _RGBMaskUV;
+ float _RGBRed_UV;
+ float _RGBGreen_UV;
+ float _RGBBlue_UV;
+ float _RGBAlpha_UV;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+
+ static float4 rgbMask;
+
+ void calculateRGBNormals(inout half3 mainTangentSpaceNormal)
+ {
+ #ifdef GEOM_TYPE_MESH
+ #ifndef RGB_MASK_TEXTURE
+ #define RGB_MASK_TEXTURE
+ UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiMesh.uv[_RGBMaskUV], _RGBMaskPanning);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+ #endif
+
+ UNITY_BRANCH
+ if(_RgbNormalsEnabled)
+ {
+ UNITY_BRANCH
+ if(_RGBNormalBlend == 0)
+ {
+ UNITY_BRANCH
+ if(_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiMesh.uv[_RgbNormalRUV], _RgbNormalRPan), _RgbNormalRScale);
+ mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ UNITY_BRANCH
+ if(_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiMesh.uv[_RgbNormalGUV], _RgbNormalGPan), _RgbNormalGScale);
+ mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ UNITY_BRANCH
+ if(_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiMesh.uv[_RgbNormalBUV], _RgbNormalBPan), _RgbNormalBScale);
+ mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ UNITY_BRANCH
+ if(_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiMesh.uv[_RgbNormalAUV], _RgbNormalAPan), _RgbNormalAScale);
+ mainTangentSpaceNormal = lerp(mainTangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+
+ return;
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiMesh.uv[_RgbNormalRUV], _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiMesh.uv[_RgbNormalGUV], _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiMesh.uv[_RgbNormalBUV], _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiMesh.uv[_RgbNormalAUV], _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ mainTangentSpaceNormal = BlendNormals(newNormal, mainTangentSpaceNormal);
+ return;
+ }
+ }
+ #endif
+ }
+
+ float3 calculateRGBMask(float3 baseColor)
+ {
+ //If RGB normals are in use this data will already exist
+ #ifndef RGB_MASK_TEXTURE
+ #define RGB_MASK_TEXTURE
+
+ UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiMesh.uv[_RGBMaskUV], _RGBMaskPanning);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+ #endif
+ #if defined(PROP_REDTEXURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexure, _MainTex, poiMesh.uv[_RGBRed_UV], _RGBRedPanning);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiMesh.uv[_RGBGreen_UV], _RGBGreenPanning);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiMesh.uv[_RGBBlue_UV], _RGBBluePanning);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiMesh.uv[_RGBAlpha_UV], _RGBAlphaPanning);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ UNITY_BRANCH
+ if(_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * _RedColor.rgb, rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * _GreenColor.rgb, rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * _BlueColor.rgb, rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * _AlphaColor.rgb, rgbMask.a * alpha.a * _AlphaColor.a);
+
+ baseColor *= RGBColor;
+ }
+ else
+ {
+ baseColor = lerp(baseColor, red.rgb * _RedColor.rgb, rgbMask.r * red.a * _RedColor.a);
+ baseColor = lerp(baseColor, green.rgb * _GreenColor.rgb, rgbMask.g * green.a * _GreenColor.a);
+ baseColor = lerp(baseColor, blue.rgb * _BlueColor.rgb, rgbMask.b * blue.a * _BlueColor.a);
+ baseColor = lerp(baseColor, alpha.rgb * _AlphaColor.rgb, rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+
+ return baseColor;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRGBMask.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRGBMask.cginc.meta
new file mode 100644
index 00000000..9c49f636
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRGBMask.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5a887d6c0dfbbba48a780737a0351a55
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRandom.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRandom.cginc
new file mode 100644
index 00000000..7870c853
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRandom.cginc
@@ -0,0 +1,41 @@
+#ifndef POI_RANDOM
+ #define POI_RANDOM
+
+ float _EnableRandom;
+ float m_start_Angle;
+ float _AngleType;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+ float _AngleCompareTo;
+
+ float ApplyAngleBasedRendering(float3 modelPos, float3 worldPos)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? modelPos : worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection)));
+ half cameraLookAtModel = remapClamped(.5 * dot(cameraToModelDirection, getCameraForward()) + .5, cameraAngleMax, cameraAngleMin, 0, 1);
+ half modelLookAtCamera = remapClamped(.5 * dot(-cameraToModelDirection, modelForwardDirection) + .5, modelAngleMax, modelAngleMin, 0, 1);
+ if (_AngleType == 0)
+ {
+ return max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if(_AngleType == 1)
+ {
+ return max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if(_AngleType == 2)
+ {
+ return max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ return 1;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRandom.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRandom.cginc.meta
new file mode 100644
index 00000000..945d4847
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRandom.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b6260b56386a2b743a6bc537a3307cc7
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRimLighting.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRimLighting.cginc
new file mode 100644
index 00000000..dd0b9fac
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRimLighting.cginc
@@ -0,0 +1,99 @@
+#ifndef POI_RIM
+#define POI_RIM
+
+float4 _RimLightColor;
+float _RimLightingInvert;
+float _RimWidth;
+float _RimStrength;
+float _RimSharpness;
+float _RimLightColorBias;
+float _ShadowMix;
+float _ShadowMixThreshold;
+float _ShadowMixWidthMod;
+float _EnableRimLighting;
+float _RimBrighten;
+float _RimLightNormal;
+float _RimHueShiftEnabled;
+float _RimHueShiftSpeed;
+float _RimHueShift;
+
+#ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+#endif
+
+#if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_RimTex);
+#endif
+#if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_RimMask);
+#endif
+#if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_RimWidthNoiseTexture);
+#endif
+
+float _RimWidthNoiseStrength;
+
+float4 rimColor = float4(0, 0, 0, 0);
+float rim = 0;
+
+void applyRimLighting(inout float4 albedo, inout float3 rimLightEmission)
+{
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+
+ float viewDotNormal = saturate(abs(dot(poiCam.viewDir, poiMesh.normals[_RimLightNormal])));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+ float rimStrength = _RimStrength;
+ float rimBrighten = _RimBrighten;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ rimStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ rimBrighten += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ rimWidth -= rimNoise;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiMesh.uv[_RimMaskUV], _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiMesh.uv[_RimTexUV], _RimTexPan) * _RimLightColor;
+ #else
+ rimColor = _RimLightColor;
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+ rimLightEmission = rim * lerp(albedo, rimColor, _RimLightColorBias) * rimStrength;
+ albedo.rgb = lerp(albedo.rgb, lerp(albedo.rgb, rimColor, _RimLightColorBias) + lerp(albedo.rgb, rimColor, _RimLightColorBias) * rimBrighten, rim);
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRimLighting.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRimLighting.cginc.meta
new file mode 100644
index 00000000..8fcf8327
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiRimLighting.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a87bd1004a9f61d4da9d5159ced4fcc8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowFrag.cginc
new file mode 100644
index 00000000..8e6499fa
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowFrag.cginc
@@ -0,0 +1,143 @@
+#ifndef SHADOW_FRAG
+#define SHADOW_FRAG
+
+float2 _MainDistanceFade;
+float _ForceOpaque;
+float _MainShadowClipMod;
+float2 _ClippingMaskPan;
+float _ClippingMaskUV;
+sampler3D _DitherMaskLOD;
+float2 _MainTexPan;
+float _MainTextureUV;
+float _Inverse_Clipping;
+float _MainDistanceFadeMin;
+float _MainDistanceFadeMax;
+half _MainMinAlpha;
+half _MainMaxAlpha;
+
+#if defined(PROP_MAINFADETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_MainFadeTexture);
+#endif
+
+float distanceFade()
+{
+ #if defined(PROP_MAINFADETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ half fadeMap = POI2D_SAMPLER_PAN(_MainFadeTexture, _MainTex, poiMesh.uv[_MainFadeTextureUV], _MainFadeTexturePan).r;
+ #else
+ half fadeMap = 1;
+ #endif
+
+ return lerp(_MainMinAlpha, _MainMaxAlpha, smoothstep(_MainDistanceFadeMin, _MainDistanceFadeMax, distance(poiMesh.worldPos, poiCam.worldPos)));
+}
+
+half4 fragShadowCaster(
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ V2FShadow i, uint facing: SV_IsFrontFace
+ #endif
+ ): SV_Target
+ {
+ poiMesh.uv[0] = i.uv;
+ poiMesh.uv[1] = i.uv1;
+ poiMesh.uv[2] = i.uv2;
+ poiMesh.uv[3] = i.uv3;
+
+ // Basically every texture relies on the maintex sampler to function and that's why this is here.
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(poiMesh.uv[_MainTextureUV], _MainTex) + _Time.x * _MainTexPan);
+
+
+ //Possible Bug with clip
+ float clipValue = clamp(_Cutoff + _MainShadowClipMod, - .001, 1.001);
+
+ poiMesh.vertexColor = saturate(i.vertexColor);
+ poiMesh.worldPos = i.worldPos;
+ poiMesh.localPos = i.localPos;
+ poiCam.worldPos = _WorldSpaceCameraPos;
+
+ #ifdef POI_MIRROR
+ applyMirrorRenderFrag();
+ #endif
+
+ #if defined(UNITY_STANDARD_USE_SHADOW_UVS)
+
+ half4 alpha = mainTexture;
+
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_BRANCH
+ if (_EnableMirrorTexture)
+ {
+ if (IsInMirror())
+ {
+ alpha.a = UNITY_SAMPLE_TEX2D_SAMPLER(_MirrorTexture, _MainTex, TRANSFORM_TEX(i.uv, _MirrorTexture)).a;
+ }
+ }
+ #endif
+
+ alpha.a *= distanceFade();
+ half alphaMask = POI2D_PAN(_ClippingMask, poiMesh.uv[_ClippingMaskUV], _ClippingMaskPan);
+ UNITY_BRANCH
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ alpha.a *= alphaMask;
+ alpha.a *= _Color.a + .0001;
+ alpha.a += _AlphaMod;
+ alpha.a = saturate(alpha.a);
+
+ UNITY_BRANCH
+ if (_Mode == 0)
+ {
+ alpha.a = 1;
+ }
+
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ applyShadowDithering(alpha.a, calcScreenUVs(i.grabPos).xy);
+ }
+
+ #ifdef POI_DISSOLVE
+ float3 fakeEmission = 1;
+ calculateDissolve(alpha, fakeEmission);
+ #endif
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ clip(alpha.a - 0.001);
+ }
+
+ /*
+ return poiMesh.vertexColor.g;
+
+ #ifdef POI_RANDOM
+ alpha.a *= i.angleAlpha;
+ #endif
+
+ UNITY_BRANCH
+ if(_Mode >= 1)
+ {
+ applySpawnInShadow(uv[0], i.localPos);
+
+ #if defined(POI_FLIPBOOK)
+ alpha.a *= applyFlipbookAlphaToShadow(uv[_FlipbookTexArrayUV]);
+ #endif
+ }
+ */
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ clip(alpha.a - clipValue);
+ }
+
+ UNITY_BRANCH
+ if (_Mode > 1)
+ {
+ float dither = tex3D(_DitherMaskLOD, float3(i.pos.xy * .25, alpha.a * 0.9375)).a;
+ clip(dither - 0.01);
+ }
+
+ #endif
+ SHADOW_CASTER_FRAGMENT(i)
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowFrag.cginc.meta
new file mode 100644
index 00000000..217949d3
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6f029ac6c95637345af7f9fa039b835d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowIncludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowIncludes.cginc
new file mode 100644
index 00000000..583b0e75
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowIncludes.cginc
@@ -0,0 +1,44 @@
+#ifndef SHADOW_INCLUDES
+ #define SHADOW_INCLUDES
+
+ #define UNITY_STANDARD_USE_SHADOW_UVS 1
+
+ float4 _Color;
+ sampler2D _ClippingMask; float4 _ClippingMask_ST;
+
+ struct VertexInputShadow
+ {
+ float4 vertex: POSITION;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float4 color: COLOR;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS)
+ struct V2FShadow
+ {
+ V2F_SHADOW_CASTER_NOPOS
+ float4 pos: SV_POSITION;
+ float2 uv: TEXCOORD1;
+ float2 uv1: TEXCOORD2;
+ float2 uv2: TEXCOORD3;
+ float2 uv3: TEXCOORD4;
+ float3 modelPos: TEXCOORD5;
+ float4 worldPos: TEXCOORD6;
+ float4 localPos: TEXCOORD7;
+ float3 angleAlpha: TEXCOORD8;
+ float4 grabPos: TEXCOORD9;
+ fixed3 barycentricCoordinates: TEXCOORD10;
+ float4 vertexColor: TEXCOORD11;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+ #endif
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowIncludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowIncludes.cginc.meta
new file mode 100644
index 00000000..e32bb288
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowIncludes.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 388afdf5d08890a498d21c55347c0a2c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowVert.cginc
new file mode 100644
index 00000000..b7d8328c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowVert.cginc
@@ -0,0 +1,86 @@
+float _EnableTouchGlow;
+float _EnableBulge;
+float _VertexManipulationHeightUV;
+
+V2FShadow vertShadowCaster(VertexInputShadow v)
+{
+ V2FShadow o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicOrifaceSystem(v);
+ #endif
+ #ifdef AUTO_EXPOSURE
+ applyLocalVertexTransformation(v.normal, v.vertex);
+ #endif
+
+ UNITY_INITIALIZE_OUTPUT(V2FShadow, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ o.localPos = v.vertex;
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicPenetrationSystem(o.localPos.rgb, v.normal.rgb, v);
+ #endif
+
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ o.uv = v.uv0;
+ o.uv1 = v.uv1;
+ o.uv2 = v.uv2;
+ o.uv3 = v.uv3;
+
+
+ float2 uvToUse = 0;
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 0)
+ {
+ uvToUse = v.uv0.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 1)
+ {
+ uvToUse = v.uv1.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 2)
+ {
+ uvToUse = v.uv2.xy;
+ }
+ UNITY_BRANCH
+ if(_VertexManipulationHeightUV == 3)
+ {
+ uvToUse = v.uv3.xy;
+ }
+ #ifdef AUTO_EXPOSURE
+ applyWorldVertexTransformation(o.worldPos, o.localPos, v.normal, uvToUse);
+ #endif
+ applyVertexGlitching(o.worldPos, o.localPos);
+ applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy);
+ #ifdef AUTO_EXPOSURE
+ applyVertexRounding(o.worldPos, o.localPos);
+ #endif
+ o.pos = UnityObjectToClipPos(o.localPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
+ o.vertexColor = v.color;
+
+ UNITY_BRANCH
+ if(_EnableTouchGlow || _EnableBulge)
+ {
+ o.pos = UnityObjectToClipPos(float3(0, 0, -5));
+ o.localPos.xyz = float3(0, 0, -5);
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ }
+
+ o.angleAlpha = 1;
+ #ifdef POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+
+ o.pos = UnityClipSpaceShadowCasterPos(o.localPos, v.normal);
+ o.pos = UnityApplyLinearShadowBias(o.pos);
+
+ return o;
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowVert.cginc.meta
new file mode 100644
index 00000000..2b45031c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiShadowVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 85240e87020438747a5fa50f428e5cdf
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInFrag.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInFrag.cginc
new file mode 100644
index 00000000..12bea5f7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInFrag.cginc
@@ -0,0 +1,58 @@
+#ifndef POI_SPAWN_IN_FRAG
+ #define POI_SPAWN_FRAG
+
+ #ifndef SPAWN_IN_VARIABLES
+ #define SPAWN_IN_VARIABLES
+
+ float3 _SpawnInGradientStart;
+ float3 _SpawnInGradientFinish;
+ fixed _SpawnInAlpha;
+ fixed _SpawnInNoiseIntensity;
+ float3 _SpawnInEmissionColor;
+ float _SpawnInEmissionOffset;
+ float _SpawnInVertOffset;
+ float _SpawnInVertOffsetOffset;
+ float _EnableScifiSpawnIn;
+ #endif
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_SpawnInNoise); float4 _SpawnInNoise_ST;
+
+ float calculateGradientValueFrag(float3 start, float3 finish, float3 localPos)
+ {
+ return inverseLerp3(start, finish, localPos);
+ }
+
+ void applySpawnIn(inout float4 finalColor, inout float3 spawnInEmission, float2 uv, float3 localPos)
+ {
+ UNITY_BRANCH
+ if (_EnableScifiSpawnIn)
+ {
+ float noise = UNITY_SAMPLE_TEX2D_SAMPLER(_SpawnInNoise, _MainTex, TRANSFORM_TEX(uv, _SpawnInNoise)).r * _SpawnInAlpha * _SpawnInNoiseIntensity;
+ float gradient = calculateGradientValueFrag(_SpawnInGradientStart, _SpawnInGradientFinish, localPos);
+ float inverseGradient = 1 - gradient;
+ float alpha = gradient - _SpawnInAlpha - noise;
+ spawnInEmission = saturate(inverseGradient + _SpawnInAlpha + _SpawnInEmissionOffset +noise - 1) * _SpawnInEmissionColor;
+ UNITY_BRANCH
+ if(_Mode >= 1)
+ {
+ clip(ceil(alpha) - 0.001);
+ }
+ }
+ }
+
+ void applySpawnInShadow(float2 uv, float3 localPos)
+ {
+ UNITY_BRANCH
+ if(_EnableScifiSpawnIn)
+ {
+ float noise = UNITY_SAMPLE_TEX2D_SAMPLER(_SpawnInNoise, _MainTex, TRANSFORM_TEX(uv, _SpawnInNoise)).r * _SpawnInAlpha * _SpawnInNoiseIntensity;
+ float gradient = calculateGradientValueFrag(_SpawnInGradientStart, _SpawnInGradientFinish, localPos);
+ float alpha = gradient - _SpawnInAlpha - noise + length(_SpawnInVertOffset);
+ UNITY_BRANCH
+ if(_Mode >= 1)
+ {
+ clip(ceil(alpha) - 0.001);
+ }
+ }
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInFrag.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInFrag.cginc.meta
new file mode 100644
index 00000000..97aa08c5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInFrag.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7913db65c40101341a2f9d4c1b15f96d
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInVert.cginc
new file mode 100644
index 00000000..01ced3fb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInVert.cginc
@@ -0,0 +1,40 @@
+#ifndef POI_SPAWN_IN_FRAG
+ #define POI_SPAWN_FRAG
+
+ #ifndef SPAWN_IN_VARIABLES
+ #define SPAWN_IN_VARIABLES
+
+ float3 _SpawnInGradientStart;
+ float3 _SpawnInGradientFinish;
+ fixed _SpawnInAlpha;
+ fixed _SpawnInNoiseIntensity;
+ float3 _SpawnInEmissionColor;
+ float _SpawnInEmissionOffset;
+ float _SpawnInVertOffset;
+ float _SpawnInVertOffsetOffset;
+ float _EnableScifiSpawnIn;
+
+ #endif
+ //sampler2D _SpawnInNoiseVert; float4 _SpawnInNoiseVert_ST;
+
+ float calculateGradientValueVert(float3 start, float3 finish, float3 localPos)
+ {
+ return inverseLerp3(start, finish, localPos);
+ }
+
+ void applySpawnInVert(inout float4 worldPos, inout float4 localPos, float2 uv)
+ {
+ UNITY_BRANCH
+ if (_EnableScifiSpawnIn)
+ {
+ float noise = 0;
+ float gradient = calculateGradientValueVert(_SpawnInGradientStart, _SpawnInGradientFinish, localPos.xyz);
+ float inverseGradient = 1 - gradient;
+ float alpha = gradient - _SpawnInAlpha - noise;
+ worldPos.xyz += saturate(inverseGradient + _SpawnInAlpha + _SpawnInVertOffsetOffset -1) * float3(0, _SpawnInVertOffset, 0);
+ localPos.xyz = mul(unity_WorldToObject, worldPos).xyz;
+ }
+ //float noise = tex2Dlod(_SpawnInNoise, float4(TRANSFORM_TEX(uv, _SpawnInNoise))).r * _SpawnInAlpha * _SpawnInNoiseIntensity;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInVert.cginc.meta
new file mode 100644
index 00000000..e6fcfee7
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpawnInVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 73fa7e501ae5f2643ac34be3ad11b72a
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpecular.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpecular.cginc
new file mode 100644
index 00000000..e205f1bf
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpecular.cginc
@@ -0,0 +1,505 @@
+#ifndef POI_SPECULAR
+#define POI_SPECULAR
+float _SpecWhatTangent;
+float _SpecularType;
+float _SmoothnessFrom;
+POI_TEXTURE_NOSAMPLER(_SpecularMetallicMap);
+POI_TEXTURE_NOSAMPLER(_SpecularMap);
+fixed _CenterOutSpecColor;
+POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMicro);
+float _SpecularAnisoJitterMirrored;
+POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMacro);
+POI_TEXTURE_NOSAMPLER(_SpecularAnisoFakeUV);
+POI_TEXTURE_NOSAMPLER(_AnisoTangentMap);
+POI_TEXTURE_NOSAMPLER(_SpecularMask);
+float _SpecularAnisoJitterMicroMultiplier;
+float _SpecularAnisoJitterMacroMultiplier;
+float4 _SpecularTint;
+float _SpecularSmoothness;
+float _Spec1Offset;
+float _Spec1JitterStrength;
+float _Spec2Smoothness;
+float _Spec2Offset;
+float _Spec2JitterStrength;
+float _AnisoUseTangentMap;
+float _AnisoSpec1Alpha;
+float _AnisoSpec2Alpha;
+float _SpecularInvertSmoothness;
+half _SpecularMetallic;
+float _SpecularNormal;
+float _SpecularNormal1;
+float _SpecularMaxBrightness;
+// Toon
+fixed _SpecularToonStart;
+fixed _SpecularToonEnd;
+half4 _SpecularToonInnerOuter;
+
+#ifdef DITHERING
+ float _EnableSpecular1;
+ float _SpecWhatTangent1;
+ float _SpecularType1;
+ float _SmoothnessFrom1;
+ POI_TEXTURE_NOSAMPLER(_SpecularMetallicMap1);
+ POI_TEXTURE_NOSAMPLER(_SpecularMap1);
+ POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMicro1);
+ POI_TEXTURE_NOSAMPLER(_SpecularAnisoJitterMacro1);
+ float _SpecularAnisoJitterMirrored1;
+ POI_TEXTURE_NOSAMPLER(_AnisoTangentMap1);
+ POI_TEXTURE_NOSAMPLER(_SpecularMask1);
+ float _SpecularAnisoJitterMicroMultiplier1;
+ float _SpecularAnisoJitterMacroMultiplier1;
+ float4 _SpecularTint1;
+ float _SpecularSmoothness1;
+ float _Spec1Offset1;
+ float _Spec1JitterStrength1;
+ float _Spec2Smoothness1;
+ float _Spec2Offset1;
+ float _Spec2JitterStrength1;
+ float _AnisoUseTangentMap1;
+ float _AnisoSpec1Alpha1;
+ float _AnisoSpec2Alpha1;
+ float _SpecularInvertSmoothness1;
+ half _SpecularMetallic1;
+ float _SpecularMaxBrightness1;
+ // Toon
+ half4 _SpecularToonInnerOuter1;
+ fixed _SpecularToonStart1;
+ fixed _SpecularToonEnd1;
+#endif
+UnityIndirect ZeroIndirect()
+{
+ UnityIndirect ind;
+ ind.diffuse = 0;
+ ind.specular = 0;
+ return ind;
+}
+
+// From unity just putting it here in case I want to mod it
+half4 poiRealisticSpecular(half3 diffColor, half3 specColor, half oneMinusReflectivity, half smoothness,
+float3 normal, float3 halfDir,
+UnityLight light, UnityIndirect gi)
+{
+ float perceptualRoughness = SmoothnessToPerceptualRoughness(smoothness);
+ #define UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV 0
+
+ #if UNITY_HANDLE_CORRECTLY_NEGATIVE_NDOTV
+ half shiftAmount = dot(normal, poiCam.viewDir);
+ normal = shiftAmount < 0.0f ? normal + poiCam.viewDir * (-shiftAmount + 1e-5f): normal;
+ float nv = saturate(dot(normal, poiCam.viewDir));
+ #else
+ half nv = abs(dot(normal, poiCam.viewDir));
+ #endif
+
+ float nl = saturate(dot(normal, light.dir));
+ float nh = saturate(dot(normal, halfDir));
+
+ half lv = saturate(dot(light.dir, poiCam.viewDir));
+ half lh = saturate(dot(light.dir, halfDir));
+
+ half diffuseTerm = DisneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;
+
+ float roughness = PerceptualRoughnessToRoughness(perceptualRoughness);
+
+ roughness = max(roughness, 0.002);
+ float V = SmithJointGGXVisibilityTerm(nl, nv, roughness);
+ float D = GGXTerm(nh, roughness);
+
+ float specularTerm = V * D * UNITY_PI;
+
+ #ifdef UNITY_COLORSPACE_GAMMA
+ specularTerm = sqrt(max(1e-4h, specularTerm));
+ #endif
+
+ specularTerm = max(0, specularTerm * nl);
+ #if defined(_POI_SPECULARHIGHLIGHTS_OFF)
+ specularTerm = 0.0;
+ #endif
+
+ half surfaceReduction;
+ #ifdef UNITY_COLORSPACE_GAMMA
+ surfaceReduction = 1.0 - 0.28 * roughness * perceptualRoughness;
+ #else
+ surfaceReduction = 1.0 / (roughness * roughness + 1.0);
+ #endif
+
+ specularTerm *= any(specColor) ? 1.0: 0.0;
+
+ half grazingTerm = saturate(smoothness + (1 - oneMinusReflectivity));
+ half3 color = diffColor * (gi.diffuse + light.color * diffuseTerm)
+ + specularTerm * light.color * FresnelTerm(specColor, lh)
+ + surfaceReduction * gi.specular * FresnelLerp(specColor, grazingTerm, nv);
+
+ return half4(color, 1);
+}
+
+half3 calculateRealisticSpecular(float4 albedo, float2 uv, float4 specularTint, float specularSmoothness, float invertSmoothness, float mixAlbedoWithTint, float4 specularMap, float3 specularLight, float3 normal, float attenuation, float3 lightDirection, float nDotL, float3 halfDir)
+{
+ half oneMinusReflectivity;
+ half3 finalSpecular;
+ UnityLight unityLight;
+ unityLight.color = specularLight;
+ unityLight.dir = lightDirection;
+ unityLight.ndotl = nDotL;
+
+ UNITY_BRANCH
+ if (_SmoothnessFrom == 0)
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specularMap.rgb * specularTint.rgb, /*out*/ oneMinusReflectivity);
+ finalSpecular = poiRealisticSpecular(diffColor, specularMap.rgb, oneMinusReflectivity, specularMap.a * specularSmoothness * lerp(1, -1, invertSmoothness), normal, halfDir, unityLight, ZeroIndirect());
+ }
+ else
+ {
+ half3 diffColor = EnergyConservationBetweenDiffuseAndSpecular(albedo, specularTint.rgb, /*out*/ oneMinusReflectivity);
+ float smoothness = max(max(specularMap.r, specularMap.g), specularMap.b);
+ finalSpecular = poiRealisticSpecular(diffColor, 1, oneMinusReflectivity, smoothness * specularSmoothness * lerp(1, -1, invertSmoothness), normal, halfDir, unityLight, ZeroIndirect());
+ }
+ finalSpecular *= lerp(1, albedo.rgb, mixAlbedoWithTint);
+ return finalSpecular;
+}
+
+half3 calculateToonSpecular(float4 albedo, float2 uv, float2 specularToonInnerOuter, float specularMixAlbedoIntoTint, float smoothnessFrom, float4 specularMap, float3 specularLight, float3 normal, float3 halfDir, float attenuation)
+{
+ half3 finalSpecular = smoothstep(1 - specularToonInnerOuter.y, 1 - specularToonInnerOuter.x, dot(halfDir, normal)) * specularLight;
+ UNITY_BRANCH
+ if (smoothnessFrom == 0)
+ {
+ finalSpecular.rgb *= specularMap.rgb * lerp(1, albedo.rgb, specularMixAlbedoIntoTint);
+ finalSpecular *= specularMap.a;
+ }
+ else
+ {
+ finalSpecular *= specularMap.r * lerp(1, albedo.rgb, specularMixAlbedoIntoTint);
+ }
+ return finalSpecular;
+}
+
+float3 strandSpecular(float TdotL, float TdotV, float specPower, float nDotL)
+{
+ #ifdef FORWARD_ADD_PASS
+ nDotL *= poiLight.attenuation * poiLight.additiveShadow;
+ #endif
+ float Specular = saturate(nDotL) * pow(saturate(sqrt(1.0 - (TdotL * TdotL)) * sqrt(1.0 - (TdotV * TdotV)) - TdotL * TdotV), specPower);
+ half normalization = sqrt((specPower + 1) * ((specPower) + 1)) / (8 * pi);
+ Specular *= normalization;
+ return Specular;
+}
+
+half3 AnisotropicSpecular(
+ float specWhatTangent, float anisoUseTangentMap, float specularSmoothness, float spec2Smoothness,
+ float anisoSpec1Alpha, float anisoSpec2Alpha, float4 specularTint, float specularMixAlbedoIntoTint, float4 specularMap, float3 specularLight, float3 lightDirection, float3 halfDir, float nDotL, float jitter, float4 packedTangentMap, in float4 albedo)
+{
+ float3 tangentOrBinormal = specWhatTangent ? poiMesh.tangent: poiMesh.binormal;
+
+
+ float3 normalLocalAniso = lerp(float3(0, 0, 1), UnpackNormal(packedTangentMap), anisoUseTangentMap);
+ normalLocalAniso = BlendNormals(normalLocalAniso, poiMesh.tangentSpaceNormal);
+ //float3 normalDirection = normalize(mul(poiMesh.normals[_SpecularNormal], poiTData.tangentTransform));
+ float3 normalDirectionAniso = Unity_SafeNormalize(mul(normalLocalAniso, poiTData.tangentTransform));
+ float3 tangentDirection = mul(poiTData.tangentTransform, tangentOrBinormal).xyz;
+ float3 viewReflectDirectionAniso = reflect(-poiCam.viewDir, normalDirectionAniso); // possible bad negation
+ float3 tangentDirectionMap = mul(poiTData.tangentToWorld, float3(normalLocalAniso.rg, 0.0)).xyz;
+ tangentDirectionMap = normalize(lerp(tangentOrBinormal, tangentDirectionMap, anisoUseTangentMap));
+
+ tangentDirectionMap += _Spec1Offset +jitter;
+
+ float TdotL = dot(lightDirection, tangentDirectionMap);
+ float TdotV = dot(poiCam.viewDir, tangentDirectionMap);
+ float TdotH = dot(halfDir, tangentDirectionMap);
+ half specPower = RoughnessToSpecPower(1.0 - specularSmoothness * specularMap.a);
+ half spec2Power = RoughnessToSpecPower(1.0 - spec2Smoothness * specularMap.a);
+ half Specular = 0;
+
+ float3 spec = strandSpecular(TdotL, TdotV, specPower, nDotL) * anisoSpec1Alpha;
+ float3 spec2 = strandSpecular(TdotL, TdotV, spec2Power, nDotL) * anisoSpec2Alpha;
+
+ return max(spec, spec2) * specularMap.rgb * specularTint.a * specularLight * lerp(1, albedo.rgb, specularMixAlbedoIntoTint);
+}
+
+inline float3 toonAnisoSpecular(float specWhatTangent, float anisoUseTangentMap, float3 lightDirection, float halfDir, float4 specularMap, float nDotL, fixed gradientStart, fixed gradientEnd, float4 specColor, float4 finalColor, fixed metallic, float jitter, float mirrored, float4 packedTangentMap)
+{
+ float3 tangentOrBinormal = specWhatTangent ? poiMesh.tangent: poiMesh.binormal;
+
+ float3 normalLocalAniso = lerp(float3(0, 0, 1), UnpackNormal(packedTangentMap), anisoUseTangentMap);
+ normalLocalAniso = BlendNormals(normalLocalAniso, poiMesh.tangentSpaceNormal);
+ //float3 normalDirection = normalize(mul(poiMesh.normals[_SpecularNormal], poiTData.tangentTransform));
+ float3 normalDirectionAniso = Unity_SafeNormalize(mul(normalLocalAniso, poiTData.tangentTransform));
+ float3 tangentDirection = mul(poiTData.tangentTransform, tangentOrBinormal).xyz;
+ float3 viewReflectDirectionAniso = reflect(-poiCam.viewDir, normalDirectionAniso); // possible bad negation
+ float3 tangentDirectionMap = mul(poiTData.tangentToWorld, float3(normalLocalAniso.rg, 0.0)).xyz;
+ tangentDirectionMap = normalize(lerp(tangentOrBinormal, tangentDirectionMap, anisoUseTangentMap));
+
+ if (!mirrored)
+ {
+ tangentDirectionMap += jitter;
+ }
+
+ float TdotL = dot(lightDirection, tangentDirectionMap);
+ float TdotV = dot(poiCam.viewDir, tangentDirectionMap);
+ float TdotH = dot(halfDir, tangentDirectionMap);
+
+ float specular = saturate(sqrt(1.0 - (TdotL * TdotL)) * sqrt(1.0 - (TdotV * TdotV)) - TdotL * TdotV);
+
+ fixed smoothAlpha = specular;
+ if (mirrored)
+ {
+ smoothAlpha = max(specular - jitter, 0);
+ }
+
+ specular = smoothstep(gradientStart, gradientEnd, smoothAlpha);
+
+ /*
+ UNITY_BRANCH
+ if(_CenterOutSpecColor)
+ {
+ specularMap = POI2D_SAMPLER_PAN(_SpecularMap, _MainTex, clamp(float2(specular, specular), 0.01, .99), _SpecularMapPan);
+ }
+ */
+
+ #ifdef FORWARD_ADD_PASS
+ nDotL *= poiLight.attenuation * poiLight.additiveShadow;
+ #endif
+
+ return saturate(nDotL) * specular * poiLight.color * specColor * specularMap.rgb * lerp(1, finalColor, metallic) * specularMap.a;
+}
+
+inline float SpecularHQ(half roughness, half dotNH, half dotLH)
+{
+ roughness = saturate(roughness);
+ roughness = max((roughness * roughness), 0.002);
+ half roughnessX2 = roughness * roughness;
+
+ half denom = dotNH * dotNH * (roughnessX2 - 1.0) + 1.0f;
+ half D = roughnessX2 / (3.14159 * denom * denom);
+
+ half k = roughness / 2.0f;
+ half k2 = k * k;
+ half invK2 = 1.0f - k2;
+
+ half vis = rcp(dotLH * dotLH * invK2 + k2);
+
+ float specTerm = vis * D;
+
+ return specTerm;
+}
+
+float3 calculateNewSpecular(in float3 specularMap, uint colorFrom, in float4 albedo, in float3 specularTint, in float specularMetallic, in float specularSmoothness, in half dotNH, in half dotLH, in float3 lightColor, in float attenuation)
+{
+ float3 specColor = specularTint;
+ float metallic = specularMetallic;
+ float roughness = 1 - specularSmoothness;
+ float perceptualRoughness = roughness;
+ //float reflectInverse = DielectricSpec.a - metallic * DielectricSpec.a;
+ //float reflectivity = 1.0h - reflectInverse;
+ float3 specMapColor = lerp(specularMap, 1, colorFrom);
+ float3 specularColor = lerp(DielectricSpec.rgb * specMapColor, lerp(specularMap, albedo.rgb, colorFrom), metallic);
+ //albedo.rgb *= reflectInverse;
+ return clamp(specularColor * lightColor * attenuation * specularTint * SpecularHQ(perceptualRoughness, dotNH, dotLH), 0, lightColor * specularTint);
+}
+
+float3 calculateSpecular(in float4 albedo)
+{
+ half3 finalSpecular = 0;
+ half3 finalSpecular1 = 0;
+ float4 realisticAlbedo = albedo;
+ float4 realisticAlbedo1 = albedo;
+ float4 specularMap = POI2D_SAMPLER_PAN(_SpecularMap, _MainTex, poiMesh.uv[_SpecularMapUV], _SpecularMapPan);
+ half metallic = POI2D_SAMPLER_PAN(_SpecularMetallicMap, _MainTex, poiMesh.uv[_SpecularMetallicMapUV], _SpecularMetallicMapPan).r * _SpecularMetallic;
+ half specularMask = POI2D_SAMPLER_PAN(_SpecularMask, _MainTex, poiMesh.uv[_SpecularMaskUV], _SpecularMaskPan).r;
+ float attenuation = saturate(poiLight.nDotL);
+
+ float3 specularLightColor = poiLight.color;
+ UNITY_BRANCH
+ if (_SpecularMaxBrightness)
+ {
+ specularLightColor = clamp(poiLight.color, 0, _SpecularMaxBrightness);
+ }
+
+ #ifdef FORWARD_ADD_PASS
+ attenuation *= poiLight.attenuation * poiLight.additiveShadow;
+ #endif
+
+ #ifdef POI_LIGHTING
+ UNITY_BRANCH
+ if (_LightingMode == 0 && _LightingRampType == 1)
+ {
+ attenuation = poiLight.rampedLightMap;
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+
+ {
+ if (_SmoothnessFrom == 1)
+ {
+ specularMap.a = specularMap.r;
+ specularMap.rgb = 1;
+ }
+
+ if (_SpecularInvertSmoothness)
+ {
+ specularMap.a = 1 - specularMap.a;
+ }
+
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, metallic, _SpecularSmoothness * specularMap.a, poiLight.dotNH, poiLight.dotLH, specularLightColor, attenuation);
+ }
+
+ UNITY_BRANCH
+ if (_SpecularType == 4)
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacroUV]), _SpecularAnisoJitterMacroPan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier;
+ jitter += _Spec1Offset;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[_AnisoTangentMapUV], _AnisoTangentMapPan);
+
+ finalSpecular += toonAnisoSpecular(_SpecWhatTangent, _AnisoUseTangentMap, poiLight.direction, poiLight.halfDir, specularMap, poiLight.nDotL, _SpecularToonStart, _SpecularToonEnd, _SpecularTint, albedo, metallic, jitter, _SpecularAnisoJitterMirrored, packedTangentMap);
+ finalSpecular *= attenuation;
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ UNITY_BRANCH
+ if (_SpecularType == 2) // Toon
+
+ {
+ finalSpecular += calculateToonSpecular(albedo, poiMesh.uv[0], _SpecularToonInnerOuter, metallic, _SmoothnessFrom, specularMap, specularLightColor, poiMesh.normals[_SpecularNormal], poiLight.halfDir, poiLight.attenuation);
+ finalSpecular *= _SpecularTint;
+ }
+ UNITY_BRANCH
+ if (_SpecularType == 3) // anisotropic
+
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicroUV]), _SpecularAnisoJitterMicroPan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacroUV]), _SpecularAnisoJitterMacroPan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier;
+ jitter += _Spec1Offset;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap, _MainTex, poiMesh.uv[_AnisoTangentMapUV], _AnisoTangentMapPan);
+
+ finalSpecular += AnisotropicSpecular(_SpecWhatTangent, _AnisoUseTangentMap, _SpecularSmoothness, _Spec2Smoothness, _AnisoSpec1Alpha, _AnisoSpec2Alpha, _SpecularTint, metallic, specularMap, specularLightColor, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap, albedo);
+ finalSpecular *= _SpecularTint;
+ finalSpecular *= attenuation;
+ }
+ #endif
+
+ #ifdef VERTEXLIGHT_ON
+ // Non Important Lights
+ for (int index = 0; index < 4; index++)
+ {
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+
+ {
+ finalSpecular += calculateNewSpecular(specularMap.rgb, _SmoothnessFrom, realisticAlbedo, _SpecularTint, metallic, _SpecularSmoothness * specularMap.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]);
+ }
+ }
+ #endif
+
+ finalSpecular *= _SpecularTint.a;
+ finalSpecular = finalSpecular.rgb;
+ finalSpecular *= specularMask;
+
+ #ifdef DITHERING
+ UNITY_BRANCH
+ if (_SpecularMaxBrightness)
+ {
+ specularLightColor = clamp(poiLight.color, 0, _SpecularMaxBrightness1);
+ }
+ float4 specularMap1 = POI2D_SAMPLER_PAN(_SpecularMap1, _MainTex, poiMesh.uv[_SpecularMap1UV], _SpecularMap1Pan);
+ half specularMask1 = POI2D_SAMPLER_PAN(_SpecularMask1, _MainTex, poiMesh.uv[_SpecularMask1UV], _SpecularMask1Pan).r;
+ half metallic1 = POI2D_SAMPLER_PAN(_SpecularMetallicMap1, _MainTex, poiMesh.uv[_SpecularMetallicMap1UV], _SpecularMetallicMap1Pan).r * _SpecularMetallic1;
+ UNITY_BRANCH
+ if (_SpecularType1 == 1) // Realistic
+
+ {
+ UNITY_BRANCH
+ if (_SmoothnessFrom1 == 1)
+ {
+ specularMap1.a = specularMap1.r;
+ specularMap1.rgb = 1;
+ }
+ else
+ {
+ realisticAlbedo1.rgb = specularMap1.rgb;
+ }
+
+ UNITY_BRANCH
+ if (_SpecularInvertSmoothness1)
+ {
+ specularMap1.a = 1 - specularMap1.a;
+ }
+
+ finalSpecular1 = calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, metallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.dotNH, poiLight.dotLH, specularLightColor, attenuation);
+ }
+
+ UNITY_BRANCH
+ if (_SpecularType1 == 4)
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored1) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier1;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacro1UV]), _SpecularAnisoJitterMacro1Pan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier1;
+ jitter += _Spec1Offset1;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[_AnisoTangentMap1UV], _AnisoTangentMap1Pan);
+
+ finalSpecular1 += toonAnisoSpecular(_SpecWhatTangent1, _AnisoUseTangentMap1, poiLight.direction, poiLight.halfDir, specularMap1, poiLight.nDotL, _SpecularToonStart1, _SpecularToonEnd1, _SpecularTint1, albedo, metallic1, jitter, _SpecularAnisoJitterMirrored1, packedTangentMap);
+ finalSpecular1 *= poiLight.attenuation;
+ }
+
+ UNITY_BRANCH
+ if (_SpecularType1 == 2) // Toon
+
+ {
+ finalSpecular1 = calculateToonSpecular(albedo, poiMesh.uv[0], _SpecularToonInnerOuter1, metallic1, _SmoothnessFrom1, specularMap1, specularLightColor, poiMesh.normals[_SpecularNormal1], poiLight.halfDir, poiLight.attenuation);
+ finalSpecular1 *= _SpecularTint1;
+ }
+ UNITY_BRANCH
+ if (_SpecularType1 == 3) // anisotropic
+
+ {
+ float jitter = 0;
+ float microJitter = POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r;
+ fixed jitterOffset = (1 - _SpecularAnisoJitterMirrored1) * .5;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMicro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMicro1UV]), _SpecularAnisoJitterMicro1Pan).r - jitterOffset) * _SpecularAnisoJitterMicroMultiplier1;
+ jitter += (POI2D_SAMPLER_PAN(_SpecularAnisoJitterMacro1, _MainTex, float2(poiMesh.uv[_SpecularAnisoJitterMacro1UV]), _SpecularAnisoJitterMacro1Pan).r - jitterOffset) * _SpecularAnisoJitterMacroMultiplier1;
+ jitter += _Spec1Offset1;
+
+ float4 packedTangentMap = POI2D_SAMPLER_PAN(_AnisoTangentMap1, _MainTex, poiMesh.uv[_AnisoTangentMap1UV], _AnisoTangentMap1Pan);
+
+ finalSpecular1 = AnisotropicSpecular(_SpecWhatTangent1, _AnisoUseTangentMap1, _SpecularSmoothness1, _Spec2Smoothness1, _AnisoSpec1Alpha1, _AnisoSpec2Alpha1, _SpecularTint1, metallic1, specularMap1, specularLightColor, poiLight.direction, poiLight.halfDir, poiLight.nDotL, jitter, packedTangentMap, albedo);
+ finalSpecular1 *= _SpecularTint1;
+ finalSpecular1 *= poiLight.attenuation;
+ }
+
+ #ifdef FORWARD_BASE_PASS
+ // Non Important Lights
+ #ifdef VERTEXLIGHT_ON
+ for (int index = 0; index < 4; index++)
+ {
+ UNITY_BRANCH
+ if (_SpecularType == 1) // Realistic
+
+ {
+ finalSpecular1 += calculateNewSpecular(specularMap1.rgb, _SmoothnessFrom1, realisticAlbedo1, _SpecularTint1, metallic1, _SpecularSmoothness1 * specularMap1.a, poiLight.vDotNH[index], poiLight.vDotLH[index], poiLight.vColor[index], poiLight.vAttenuationDotNL[index]);
+ }
+ }
+ #endif
+ #endif
+
+ finalSpecular1 *= _SpecularTint1.a;
+ finalSpecular1 = finalSpecular1.rgb;
+ finalSpecular1 *= specularMask1;
+
+ #endif
+
+ return finalSpecular + finalSpecular1;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpecular.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpecular.cginc.meta
new file mode 100644
index 00000000..99ab9d9b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSpecular.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: da46d1a0fb2f8cc48a64a10aabc5df20
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc
new file mode 100644
index 00000000..5878059b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc
@@ -0,0 +1,75 @@
+#ifndef SUBSURFACE
+ #define SUBSURFACE
+ /*
+ float _SSSThickness;
+ half4 _SSSColor;
+ float _SSSPointLightDirectionality;
+ float _SSSNormalOffset;
+ float _SSSStrength;
+ float _SSSExponent;
+ float _SSSNDotL;
+ float _SSSConstant;
+
+ #if defined(PROP_SSSTHICKNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_SSSThicknessMap);
+ #endif
+
+ half3 calculateSubsurfaceScattering(const float4 albedo)
+ {
+ #if defined(PROP_SSSTHICKNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ float thicknessMap = 1 - POI2D_SAMPLER_PAN(_SSSThicknessMap, _MainTex, poiMesh.uv[_SSSThicknessMapUV], _SSSThicknessMapPan);
+ #else
+ float thicknessMap = 1;
+ #endif
+
+ half4 translucencyColor = _SSSColor;
+ float3 lightDir = poiLight.direction;
+
+ #ifdef FORWARD_BASE_PASS
+ half tLitDot = saturate(dot((poiLight.direction + poiMesh.normals[1] * _SSSNormalOffset), -poiCam.viewDir));
+ #else
+ float3 lightDirectional = normalize(_WorldSpaceLightPos0.xyz - poiCam.worldPos);
+ lightDir = normalize(lerp(poiLight.direction, lightDirectional, _SSSPointLightDirectionality));
+ half tLitDot = saturate(dot((poiLight.direction + poiMesh.normals[1] * _SSSNormalOffset), -poiCam.viewDir));
+ #endif
+
+ tLitDot = exp2(-_SSSExponent * (1 - tLitDot)) * _SSSStrength;
+ float NDotL = abs(dot(poiLight.direction, poiMesh.normals[1]));
+ tLitDot *= lerp(1, NDotL, _SSSNDotL);
+
+ half translucencyOcclusion = lerp(1, thicknessMap, _SSSThickness);
+ half translucencyAtten = (tLitDot + _SSSConstant * (NDotL + 0.1)) * translucencyOcclusion;
+
+ return translucencyAtten * albedo.rgb * translucencyColor.rgb * poiLight.lightMap * poiLight.color;
+ }
+ */
+
+ float _SSSThicknessMod;
+ float _SSSSCale;
+ float _SSSPower;
+ float _SSSDistortion;
+ float4 _SSSColor;
+ float _EnableSSS;
+
+ #if defined(PROP_SSSTHICKNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_SSSThicknessMap);
+ #endif
+
+ float3 calculateSubsurfaceScattering()
+ {
+ #if defined(PROP_SSSTHICKNESSMAP) || !defined(OPTIMIZER_ENABLED)
+ float SSS = 1 - POI2D_SAMPLER_PAN(_SSSThicknessMap, _MainTex, poiMesh.uv[_SSSThicknessMapUV], _SSSThicknessMapPan);
+ #else
+ float SSS = 1;
+ #endif
+ half3 vLTLight = poiLight.direction + poiMesh.normals[0] * _SSSDistortion;
+ half flTDot = pow(saturate(dot(poiCam.viewDir, -vLTLight)), _SSSPower) * _SSSSCale;
+ #ifdef FORWARD_BASE_PASS
+ half3 fLT = (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #else
+ half3 fLT = poiLight.attenuation * (flTDot) * saturate(SSS + - 1 * _SSSThicknessMod);
+ #endif
+
+ return fLT * poiLight.color * _SSSColor * poiLight.attenuation;
+ }
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc.meta
new file mode 100644
index 00000000..f2f00eaf
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiSubsurfaceScattering.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c86cb17bac1d3ae469535ac16b47fcf9
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiTessellation.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiTessellation.cginc
new file mode 100644
index 00000000..a35f940f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiTessellation.cginc
@@ -0,0 +1,117 @@
+#ifndef POI_TESSELLATION
+ #define POI_TESSELLATION
+
+ float _TessellationPhongStrength;
+ float _TessellationEdgeLength;
+ float _TessellationExtrusionAmount;
+ float _TessellationUniform;
+
+ struct TessellationControlPoint
+ {
+ float4 vertex: INTERNALTESSPOS;
+ float3 normal: NORMAL;
+ float4 tangent: TANGENT;
+ float4 color: COLOR;
+ float2 uv0: TEXCOORD0;
+ float2 uv1: TEXCOORD1;
+ float2 uv2: TEXCOORD2;
+ float2 uv3: TEXCOORD3;
+ };
+
+ struct TessellationFactors
+ {
+ float edge[3]: SV_TessFactor;
+ float inside: SV_InsideTessFactor;
+ };
+
+ TessellationControlPoint poiTessellationVert(appdata v)
+ {
+ TessellationControlPoint p;
+ p.vertex = v.vertex;
+ p.normal = v.normal;
+ p.tangent = v.tangent;
+ p.color = v.color;
+ p.uv0 = v.uv0;
+ p.uv1 = v.uv1;
+ p.uv2 = v.uv2;
+ p.uv3 = v.uv3;
+ return p;
+ }
+
+ float TessellationEdgeFactor(float3 p0, float3 p1)
+ {
+ #ifndef _FADING_ON
+ float edgeLength = distance(p0, p1);
+
+ float3 edgeCenter = (p0 + p1) * 0.5;
+ float viewDistance = distance(edgeCenter, _WorldSpaceCameraPos);
+
+ return edgeLength * _ScreenParams.y /
+ (_TessellationEdgeLength * viewDistance);
+ #else
+ return _TessellationUniform;
+ #endif
+ }
+
+ TessellationFactors poiPatchConst(
+ InputPatch < TessellationControlPoint, 3 > patch
+ )
+ {
+
+ TessellationFactors f;
+ float3 p0 = mul(unity_ObjectToWorld, patch[0].vertex).xyz;
+ float3 p1 = mul(unity_ObjectToWorld, patch[1].vertex).xyz;
+ float3 p2 = mul(unity_ObjectToWorld, patch[2].vertex).xyz;
+ f.edge[0] = TessellationEdgeFactor(p1, p2);
+ f.edge[1] = TessellationEdgeFactor(p2, p0);
+ f.edge[2] = TessellationEdgeFactor(p0, p1);
+ f.inside = (TessellationEdgeFactor(p1, p2) +
+ TessellationEdgeFactor(p2, p0) +
+ TessellationEdgeFactor(p0, p1)) * (1 / 3.0);
+ return f;
+ }
+
+ [UNITY_domain("tri")]
+ [UNITY_outputcontrolpoints(3)]
+ [UNITY_outputtopology("triangle_cw")]
+ [UNITY_partitioning("fractional_odd")]
+ [UNITY_patchconstantfunc("poiPatchConst")]
+ TessellationControlPoint poiHull(
+ InputPatch < TessellationControlPoint, 3 > patch,
+ uint id: SV_OutputControlPointID
+ )
+ {
+ return patch[id];
+ }
+
+ [UNITY_domain("tri")]
+ v2f poiDomain(
+ TessellationFactors factors,
+ OutputPatch < TessellationControlPoint, 3 > patch,
+ float3 barycentricCoordinates: SV_DomainLocation
+ )
+ {
+ appdata data;
+
+ #define MY_DOMAIN_PROGRAM_INTERPOLATE(fieldName) data.fieldName = patch[0].fieldName * barycentricCoordinates.x + patch[1].fieldName * barycentricCoordinates.y + patch[2].fieldName * barycentricCoordinates.z;
+
+ MY_DOMAIN_PROGRAM_INTERPOLATE(vertex)
+ float3 pp[3];
+ for (int i = 0; i < 3; ++ i)
+ {
+ pp[i] = data.vertex.xyz - patch[i].normal * (dot(data.vertex.xyz, patch[i].normal) - dot(patch[i].vertex.xyz, patch[i].normal));
+ }
+ data.vertex.xyz = _TessellationPhongStrength * (pp[0] * barycentricCoordinates.x + pp[1] * barycentricCoordinates.y + pp[2] * barycentricCoordinates.z) + (1.0f - _TessellationPhongStrength) * data.vertex.xyz;
+ MY_DOMAIN_PROGRAM_INTERPOLATE(normal)
+ data.vertex.xyz += data.normal.xyz * _TessellationExtrusionAmount;
+ MY_DOMAIN_PROGRAM_INTERPOLATE(tangent)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(color)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv0)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv1)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv2)
+ MY_DOMAIN_PROGRAM_INTERPOLATE(uv3)
+
+ return vert(data);
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiTessellation.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiTessellation.cginc.meta
new file mode 100644
index 00000000..4ddeb912
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiTessellation.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: cb923a9217d969d40a045da0c480df7e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiUVDistortion.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiUVDistortion.cginc
new file mode 100644
index 00000000..9a3d5455
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiUVDistortion.cginc
@@ -0,0 +1,74 @@
+#ifndef POI_UV_DISTORTION
+#define POI_UV_DISTORTION
+
+#if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture); float4 _DistortionFlowTexture_ST;
+#endif
+#if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_DistortionFlowTexture1); float4 _DistortionFlowTexture1_ST;
+#endif
+#if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_DistortionMask);
+#endif
+
+half _DistortionStrength;
+half _DistortionStrength1;
+half2 _DistortionSpeed;
+half2 _DistortionSpeed1;
+
+#ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+
+#endif
+
+float2 getTorusUv(float2 uv)
+{
+ // translated to hlsl from https://www.shadertoy.com/view/Md3Bz7
+ // http://web.cs.ucdavis.edu/~amenta/s12/findnorm.pdf
+ float phi = 6.28318530718f * uv.x;
+ float theta = 6.28318530718f * uv.y;
+ float3 c = cos(float3(phi, phi + 1.57079632679f, theta));
+ float2 result = float2(c.x * c.z, -c.y * c.z);
+ return result * 0.5 + 0.5;
+}
+
+float2 calculateDistortionUV(float2 uv)
+{
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture) + _Time.x * _DistortionSpeed) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #endif
+ #if defined(PROP_DISTORTIONFLOWTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector1 = UNITY_SAMPLE_TEX2D_SAMPLER(_DistortionFlowTexture1, _MainTex, TRANSFORM_TEX(poiMesh.uv[0], _DistortionFlowTexture1) + _Time.x * _DistortionSpeed1) * 2 - 1;
+ #else
+ float4 flowVector1 = 0;
+ #endif
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkTextureExists && _EnableDistortionAudioLink)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, poiMods.audioLink[_DistortionStrengthAudioLinkBand]);
+ distortionStrength1 += lerp(_DistortionStrength1AudioLink.x, _DistortionStrength1AudioLink.y, poiMods.audioLink[_DistortionStrength1AudioLinkBand]);
+ }
+ #endif
+
+ flowVector *= distortionStrength;
+ flowVector1 *= distortionStrength1;
+ return uv + ((flowVector.xy + flowVector1.xy) / 2) * distortionMask;
+}
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiUVDistortion.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiUVDistortion.cginc.meta
new file mode 100644
index 00000000..e949dffd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiUVDistortion.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b781c7822eb79cd4d94941b850ec86fd
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiV2F.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiV2F.cginc
new file mode 100644
index 00000000..b4ab59ff
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiV2F.cginc
@@ -0,0 +1,35 @@
+#ifndef POI_V2F
+ #define POI_V2F
+
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ float4 uv0: TEXCOORD0;
+ float4 uv1: TEXCOORD1;
+ float3 normal: TEXCOORD2;
+ float3 tangentViewDir: TEXCOORD3;
+ float4 tangent: TEXCOORD4;
+ float4 binormal: TEXCOORD5;
+ float4 worldPos: TEXCOORD6;
+ float4 localPos: TEXCOORD7;
+ float4 grabPos: TEXCOORD8;
+ float3 barycentricCoordinates: TEXCOORD9;
+ #if defined(GRAIN)
+ float4 worldDirection: TEXCOORD10;
+ #endif
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ float4 lightmapUV: TEXCOORD11;
+ #endif
+ float3 modelPos: TEXCOORD12;
+ float angleAlpha: TEXCOORD13;
+ float4 vertexColor: TEXCOORD14;
+ #ifdef FUR
+ float furAlpha: TEXCOORD15;
+ #endif
+ UNITY_SHADOW_COORDS(16)
+ UNITY_FOG_COORDS(17)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiV2F.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiV2F.cginc.meta
new file mode 100644
index 00000000..b99520d2
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiV2F.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ef2c28e0e6cae3d49989341119faa165
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVert.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVert.cginc
new file mode 100644
index 00000000..63cde28b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVert.cginc
@@ -0,0 +1,145 @@
+#ifndef POI_VERT
+#define POI_VERT
+
+float _VertexManipulationHeightUV;
+float _VertexUnwrap;
+
+#define PM UNITY_MATRIX_P
+
+inline float4 CalculateFrustumCorrection()
+{
+ float x1 = -PM._31 / (PM._11 * PM._34);
+ float x2 = -PM._32 / (PM._22 * PM._34);
+ return float4(x1, x2, 0, PM._33 / PM._34 + x1 * PM._13 + x2 * PM._23);
+}
+
+float3 CreateBinormal(half3 normal, half3 tangent, half tangentSign)
+{
+ half sign = tangentSign * unity_WorldTransformParams.w;
+ return cross(normal, tangent) * sign;
+}
+
+v2f vert(appdata v)
+{
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+
+ #ifdef _COLOROVERLAY_ON
+ v.vertex.xyz = lerp(v.vertex.xyz, float3(v.uv0.x - .5, v.uv0.y - .5, 0), _VertexUnwrap);
+ #endif
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicOrifaceSystem(v);
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ applyLocalVertexTransformation(v.normal, v.tangent, v.vertex);
+ #endif
+
+
+ UNITY_INITIALIZE_OUTPUT(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+
+ #ifdef _REQUIRE_UV2 //POI_MIRROR
+ applyMirrorRenderVert(v.vertex);
+ #endif
+
+ TANGENT_SPACE_ROTATION;
+ o.localPos = v.vertex;
+ o.worldPos = mul(unity_ObjectToWorld, o.localPos);
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #ifdef RALIV_PENETRATION
+ applyRalivDynamicPenetrationSystem(o.localPos.rgb, o.normal.rgb, v);
+ #endif
+
+ //o.localPos.x *= -1;
+ //o.localPos.xz += sin(o.localPos.y * 100 + _Time.y * 5) * .0025;
+
+ float2 uvToUse = 0;
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 0)
+ {
+ uvToUse = v.uv0.xy;
+ }
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 1)
+ {
+ uvToUse = v.uv1.xy;
+ }
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 2)
+ {
+ uvToUse = v.uv2.xy;
+ }
+ UNITY_BRANCH
+ if (_VertexManipulationHeightUV == 3)
+ {
+ uvToUse = v.uv3.xy;
+ }
+ #ifdef AUTO_EXPOSURE
+ applyWorldVertexTransformation(o.worldPos, o.localPos, o.normal, uvToUse);
+ #endif
+ applyVertexGlitching(o.worldPos, o.localPos);
+ applySpawnInVert(o.worldPos, o.localPos, v.uv0.xy);
+ #ifdef AUTO_EXPOSURE
+ applyVertexRounding(o.worldPos, o.localPos);
+ #endif
+ o.pos = UnityObjectToClipPos(o.localPos);
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+ o.uv0.xy = v.uv0.xy;
+ o.uv0.zw = v.uv1.xy;
+ o.uv1.xy = v.uv2.xy;
+ o.uv1.zw = v.uv3.xy;
+ o.vertexColor = v.color;
+ o.modelPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.tangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w);
+
+ o.binormal.rgb = CreateBinormal(o.normal.xyz, o.tangent.xyz, o.tangent.w);
+
+ #ifdef POI_BULGE
+ bulgyWolgy(o);
+ #endif
+
+
+ o.angleAlpha = 1;
+ #ifdef _SUNDISK_NONE //POI_RANDOM
+ o.angleAlpha = ApplyAngleBasedRendering(o.modelPos, o.worldPos);
+ #endif
+
+ #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
+
+ UNITY_TRANSFER_SHADOW(o, o.uv0.xy);
+ UNITY_TRANSFER_FOG(o, o.pos);
+
+ v.tangent.xyz = normalize(v.tangent.xyz);
+ v.normal = normalize(v.normal);
+ float3x3 objectToTangent = float3x3(
+ v.tangent.xyz,
+ cross(v.normal, v.tangent.xyz) * v.tangent.w,
+ v.normal
+ );
+ o.tangentViewDir = mul(objectToTangent, ObjSpaceViewDir(v.vertex));
+
+ #ifdef POI_META_PASS
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+
+ return o;
+}
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVert.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVert.cginc.meta
new file mode 100644
index 00000000..200d2fcc
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVert.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c608d4e6f9b40dc4a854fca20604e6b6
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVertexManipulations.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVertexManipulations.cginc
new file mode 100644
index 00000000..cf586808
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVertexManipulations.cginc
@@ -0,0 +1,102 @@
+#ifndef POI_VERTEX_MANIPULATION
+ #define POI_VERTEX_MANIPULATION
+
+ #include "CGI_PoiMath.cginc"
+
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+
+ float _VertexManipulationHeight;
+ float _VertexManipulationHeightBias;
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ sampler2D _VertexManipulationHeightMask; float4 _VertexManipulationHeightMask_ST;
+ #endif
+ float2 _VertexManipulationHeightPan;
+
+
+ //Vertex Glitching
+ float _EnableVertexGlitch;
+ float _VertexGlitchThreshold;
+ float _VertexGlitchFrequency;
+ float _VertexGlitchStrength;
+ // Rounding
+ float _VertexRoundingDivision;
+ float _VertexRoundingEnabled;
+
+ void applyLocalVertexTransformation(inout float3 normal, inout float4 tangent, inout float4 vertex)
+ {
+ normal = rotate_with_quaternion(normal, _VertexManipulationLocalRotation.xyz);
+ tangent.xyz = rotate_with_quaternion(tangent.xyz, _VertexManipulationLocalRotation.xyz);
+ vertex = transform(vertex, _VertexManipulationLocalTranslation, _VertexManipulationLocalRotation, _VertexManipulationLocalScale);
+
+ //vertex = float4(vertex.x + sin(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), vertex.y, vertex.z + cos(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), 1);
+ }
+
+ void applyLocalVertexTransformation(inout float3 normal, inout float4 vertex)
+ {
+ normal = rotate_with_quaternion(normal, _VertexManipulationLocalRotation.xyz);
+ vertex = transform(vertex, _VertexManipulationLocalTranslation, _VertexManipulationLocalRotation, _VertexManipulationLocalScale);
+
+ //vertex = float4(vertex.x + sin(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), vertex.y, vertex.z + cos(_Time.y*1.5 + vertex.y * 50) * .75 * smoothstep( .3, -1, vertex.y), 1);
+ }
+
+ void applyWorldVertexTransformation(inout float4 worldPos, inout float4 localPos, inout float3 worldNormal, float2 uv)
+ {
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(TRANSFORM_TEX(uv, _VertexManipulationHeightMask) + _VertexManipulationHeightPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * _VertexManipulationHeight * worldNormal;
+ #else
+ float3 heightOffset = _VertexManipulationHeight * worldNormal;
+ #endif
+ worldPos.rgb += _VertexManipulationWorldTranslation.xyz/* * _VertexManipulationWorldTranslation.w*/ + heightOffset;
+ localPos.xyz = mul(unity_WorldToObject, worldPos).xyz;
+ }
+
+ void applyWorldVertexTransformationShadow(inout float4 worldPos, inout float4 localPos, float3 worldNormal, float2 uv)
+ {
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(TRANSFORM_TEX(uv, _VertexManipulationHeightMask) + _VertexManipulationHeightPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * _VertexManipulationHeight * worldNormal;
+ #else
+ float3 heightOffset = _VertexManipulationHeight * worldNormal;
+ #endif
+ worldPos.rgb += _VertexManipulationWorldTranslation.xyz/* * _VertexManipulationWorldTranslation.w*/ + heightOffset;
+ localPos.xyz = mul(unity_WorldToObject, worldPos).xyz;
+ }
+
+ void applyVertexRounding(inout float4 worldPos, inout float4 localPos)
+ {
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ worldPos.xyz = (ceil(worldPos.xyz * _VertexRoundingDivision) / _VertexRoundingDivision) - 1 / _VertexRoundingDivision * .5;
+ localPos = mul(unity_WorldToObject, worldPos);
+ }
+ }
+
+ void applyVertexGlitching(inout float4 worldPos, inout float4 localPos)
+ {
+ UNITY_BRANCH
+ if(_EnableVertexGlitch)
+ {
+ float3 forward = getCameraPosition() - mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ forward.y = 0;
+ forward = normalize(forward);
+ float3 glitchDirection = normalize(cross(float3(0, 1, 0), forward));
+ float glitchAmount = frac(sin(dot(_Time.xy + worldPos.y, float2(12.9898, 78.233))) * 43758.5453123) * 2 - 1;
+ /*
+ float uvl = worldPos.y * _VertexGlitchDensity + _Time.x * _VertexGlitchMapPanSpeed;
+ float uvr = worldPos.y * _VertexGlitchDensity - _Time.x * _VertexGlitchMapPanSpeed;
+ float glitchAmountLeft = tex2Dlod(_VertexGlitchMap, float4(uvl, uvl, 0, 0)).r;
+ float glitchAmountRight = -tex2Dlod(_VertexGlitchMap, float4(uvr, uvr, 0, 0)).r;
+ float glitchAmount = glitchAmountLeft + glitchAmountRight;
+ */
+ 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;
+ worldPos.xyz += glitchAmount * glitchDirection * (_VertexGlitchStrength * .01) * step(_VertexGlitchThreshold, randomGlitch);
+ localPos = mul(unity_WorldToObject, worldPos);
+ }
+ }
+
+#endif
+// \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVertexManipulations.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVertexManipulations.cginc.meta
new file mode 100644
index 00000000..b0ae7b8d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVertexManipulations.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8f221171da2883d41ab5a08dd1de9779
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVideo.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVideo.cginc
new file mode 100644
index 00000000..2e4625e1
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVideo.cginc
@@ -0,0 +1,297 @@
+#ifndef POI_VIDEO
+ #define POI_VIDEO
+
+ #if defined(PROP_VIDEOPIXELTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoPixelTexture); float4 _VideoPixelTexture_ST;
+ #endif
+ #if defined(PROP_VIDEOMASKTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoMaskTexture); float4 _VideoMaskTexture_ST;
+ #endif
+ #if defined(PROP_VIDEOGAMEBOYRAMP) || !defined(OPTIMIZER_ENABLED)
+ sampler2D _VideoGameboyRamp;
+ #endif
+ #if defined(PROP_VIDEODEBUGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_VideoDebugTexture); float4 _VideoDebugTexture_ST;
+ #endif
+
+ float _VideoUVNumber;
+ float _VideoType;
+ float3 pixels;
+ float2 _VideoResolution;
+ half _VideoBacklight;
+ half _VideoCRTRefreshRate;
+ half _VideoCRTPixelEnergizedTime;
+ half _VideoEnableVideoPlayer;
+ half _VideoRepeatVideoTexture;
+ half _VideoPixelateToResolution;
+ float2 _VideoMaskPanning;
+ float _VideoEmissionEnabled;
+ // Video Settings
+ half _VideoSaturation;
+ half _VideoContrast;
+ float2 _VideoTiling;
+ float2 _VideoOffset;
+ float2 _VideoPanning;
+
+ //Debug
+ half _VideoEnableDebug;
+
+
+
+ sampler2D _VRChat_VideoPlayer;
+ float4 _VRChat_VideoPlayer_TexelSize;
+
+ float4 globalVideoPlayerColor;
+ float3 globalColorToDisplayOnScreen;
+ float globalVideoOn;
+
+ float3 applyBacklight(float3 albedo, half backlightStrength)
+ {
+ return max(backlightStrength, albedo.rgb);
+ }
+
+ float3 applyViewAngleTN(float3 albedo)
+ {
+ float3 reflectionVector = normalize(reflect(poiCam.viewDir.rgb, poiMesh.normals[1].rgb));
+ float upwardShift = dot(reflectionVector, poiMesh.binormal);
+ upwardShift = pow(upwardShift, 1);
+ float sideShift = dot(reflectionVector, poiMesh.tangent);
+ sideShift *= pow(sideShift, 3);
+ #if !UNITY_COLORSPACE_GAMMA
+ albedo = LinearToGammaSpace(albedo);
+ #endif
+ albedo = saturate(lerp(half3(0.5, 0.5, 0.5), albedo, upwardShift + 1));
+ #if !UNITY_COLORSPACE_GAMMA
+ albedo = GammaToLinearSpace(albedo);
+ #endif
+ albedo = (lerp(albedo, albedo.gbr, sideShift));
+ return albedo;
+ }
+
+ float calculateCRTPixelBrightness()
+ {
+ float totalPixels = _VideoResolution.x * _VideoResolution.y;
+ float2 uvPixel = float2((floor((1 - poiMesh.uv[_VideoUVNumber].y) * _VideoResolution.y)) / _VideoResolution.y, (floor(poiMesh.uv[_VideoUVNumber].x * _VideoResolution.x)) / _VideoResolution.x);
+ float currentPixelNumber = _VideoResolution.x * (_VideoResolution.y * uvPixel.x) + _VideoResolution.y * uvPixel.y;
+ float currentPixelAlpha = currentPixelNumber / totalPixels;
+ half electronBeamAlpha = frac(_Time.y * _VideoCRTRefreshRate);
+ float electronBeamPixelNumber = totalPixels * electronBeamAlpha;
+
+ float DistanceInPixelsFromCurrentElectronBeamPixel = 0;
+ if (electronBeamPixelNumber >= currentPixelNumber)
+ {
+ DistanceInPixelsFromCurrentElectronBeamPixel = electronBeamPixelNumber - currentPixelNumber;
+ }
+ else
+ {
+ DistanceInPixelsFromCurrentElectronBeamPixel = electronBeamPixelNumber + (totalPixels - currentPixelNumber);
+ }
+ float CRTFrameTime = 1 / _VideoCRTRefreshRate;
+ float timeSincecurrentPixelWasHitByElectronBeam = (DistanceInPixelsFromCurrentElectronBeamPixel / totalPixels);
+
+ return saturate(_VideoCRTPixelEnergizedTime - timeSincecurrentPixelWasHitByElectronBeam);
+ }
+
+ void applyContrastSettings(inout float3 pixel)
+ {
+ #if !UNITY_COLORSPACE_GAMMA
+ pixel = LinearToGammaSpace(pixel);
+ #endif
+ pixel = saturate(lerp(half3(0.5, 0.5, 0.5), pixel, _VideoContrast + 1));
+ #if !UNITY_COLORSPACE_GAMMA
+ 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 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01);
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ albedo.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight + albedo * .000001;
+ }
+ void calculateTN(inout float4 albedo)
+ {
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ globalColorToDisplayOnScreen = applyBacklight(globalColorToDisplayOnScreen, _VideoBacklight * .01);
+ globalColorToDisplayOnScreen = applyViewAngleTN(globalColorToDisplayOnScreen);
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ albedo.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight + albedo * .000001;
+ }
+ void calculateCRT(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ float brightness = calculateCRTPixelBrightness();
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ albedo.rgb = globalColorToDisplayOnScreen * pixels * brightness * _VideoBacklight + albedo * .000001;
+ }
+ void calculateOLED(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ albedo.rgb = globalColorToDisplayOnScreen * pixels * _VideoBacklight + albedo * .000001;
+ }
+ void calculateGameboy(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+ half brightness = saturate((globalColorToDisplayOnScreen.r + globalColorToDisplayOnScreen.g + globalColorToDisplayOnScreen.b) * .3333333);
+ #if defined(PROP_VIDEOGAMEBOYRAMP) || !defined(OPTIMIZER_ENABLED)
+ albedo.rgb = tex2D(_VideoGameboyRamp, brightness);
+ #endif
+ }
+ void calculateProjector(inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 0)
+ {
+ globalColorToDisplayOnScreen = albedo;
+ }
+ applyVideoSettings(globalColorToDisplayOnScreen);
+
+ float3 projectorColor = albedo * globalColorToDisplayOnScreen * _VideoBacklight;
+ albedo.r = clamp(projectorColor.r, albedo.r, 1000);
+ albedo.g = clamp(projectorColor.g, albedo.g, 1000);
+ albedo.b = clamp(projectorColor.b, albedo.b, 1000);
+ }
+
+ void applyScreenEffect(inout float4 albedo, inout float3 videoEmission)
+ {
+ float4 albedoBeforeScreen = albedo;
+ #if defined(PROP_VIDEOPIXELTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ pixels = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoPixelTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoPixelTexture) * _VideoResolution);
+ #else
+ pixels = 1;
+ #endif
+ globalVideoOn = 0;
+ UNITY_BRANCH
+ if(_VideoEnableVideoPlayer == 1)
+ {
+ float4 videoTexture = 0;
+ UNITY_BRANCH
+ if(_VideoPixelateToResolution)
+ {
+ UNITY_BRANCH
+ if(_VideoEnableDebug)
+ {
+ #if defined(PROP_VIDEODEBUGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ videoTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoDebugTexture, _MainTex, round(TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoDebugTexture) * _VideoResolution + .5) / _VideoResolution);
+ #else
+ videoTexture = 1;
+ #endif
+ }
+ else
+ {
+ videoTexture = tex2D(_VRChat_VideoPlayer, round(poiMesh.uv[_VideoUVNumber] * _VideoResolution + .5) / _VideoResolution);
+ }
+ }
+ else
+ {
+ UNITY_BRANCH
+ if(_VideoEnableDebug)
+ {
+ #if defined(PROP_VIDEODEBUGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ videoTexture = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoDebugTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoDebugTexture) * _VideoTiling + _VideoOffset);
+ #else
+ videoTexture = 1;
+ #endif
+ }
+ else
+ {
+ videoTexture = tex2D(_VRChat_VideoPlayer, ((poiMesh.uv[_VideoUVNumber] + _Time.x * _VideoPanning) * _VideoTiling) + _VideoOffset);
+ }
+ }
+ if(videoTexture.a == 1)
+ {
+ globalColorToDisplayOnScreen = videoTexture.rgb;
+ globalVideoOn = 1;
+ }
+ }
+
+ UNITY_BRANCH
+ if(_VideoRepeatVideoTexture == 1)
+ {
+ if(poiMesh.uv[_VideoUVNumber].x > 1 || poiMesh.uv[_VideoUVNumber].x < 0 || poiMesh.uv[_VideoUVNumber].y > 1 || poiMesh.uv[_VideoUVNumber].y < 0)
+ {
+ return;
+ }
+ }
+
+ switch(_VideoType)
+ {
+ case 0: // LCD
+ {
+ calculateLCD(albedo);
+ break;
+ }
+ case 1: // TN
+ {
+ calculateTN(albedo);
+ break;
+ }
+ case 2: // CRT
+ {
+ calculateCRT(albedo);
+ break;
+ }
+ case 3: // OLED
+ {
+ calculateOLED(albedo);
+ break;
+ }
+ case 4: // Gameboy
+ {
+ calculateGameboy(albedo);
+ break;
+ }
+ case 5: // Projector
+ {
+ calculateProjector(albedo);
+ break;
+ }
+ }
+ #if defined(PROP_VIDEOMASKTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float screenMask = UNITY_SAMPLE_TEX2D_SAMPLER(_VideoMaskTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_VideoUVNumber], _VideoMaskTexture) + _Time.x * _VideoMaskPanning);
+ #else
+ float screenMask = 1;
+ #endif
+
+ albedo = lerp(albedoBeforeScreen, albedo, screenMask);
+ UNITY_BRANCH
+ if (_VideoEmissionEnabled)
+ {
+ videoEmission = albedo.rgb * screenMask;
+ }
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVideo.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVideo.cginc.meta
new file mode 100644
index 00000000..34b51bfb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVideo.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ff77987a6a6483746ae074933182b0e0
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVoronoi.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVoronoi.cginc
new file mode 100644
index 00000000..92cb1a5a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVoronoi.cginc
@@ -0,0 +1,312 @@
+#ifndef POI_VORONOI
+ #define POI_VORONOI
+
+ float _VoronoiSpace;
+ float _VoronoiBlend;
+ float _VoronoiType;
+ float4 _VoronoiColor0;
+ float _VoronoiEmission0;
+ float4 _VoronoiColor1;
+ float _VoronoiEmission1;
+ float2 _VoronoiGradient;
+ float _VoronoiScale;
+ float3 _VoronoiSpeed;
+ float _VoronoiEnableRandomCellColor;
+ float2 _VoronoiRandomMinMaxSaturation;
+ float2 _VoronoiRandomMinMaxBrightness;
+ float3 randomPoint;
+ float _VoronoiEffectsMaterialAlpha;
+
+ #if defined(PROP_VORONOIMASK) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_VoronoiMask);
+ #endif
+ #if defined(PROP_VORONOINOISE) || !defined(OPTIMIZER_ENABLED)
+ POI_TEXTURE_NOSAMPLER(_VoronoiNoise);
+ #endif
+ float _VoronoiNoiseIntensity;
+
+ float2 inoise(float3 P, float jitter)
+ {
+ float3 Pi = mod(floor(P), 289.0);
+ float3 Pf = frac(P);
+ float3 oi = float3(-1.0, 0.0, 1.0);
+ float3 of = float3(-0.5, 0.5, 1.5);
+ float3 px = Permutation(Pi.x + oi);
+ float3 py = Permutation(Pi.y + oi);
+
+ float3 p, ox, oy, oz, dx, dy, dz;
+ float2 F = 1e6;
+
+ for (int i = 0; i < 3; i ++)
+ {
+ for (int j = 0; j < 3; j ++)
+ {
+ p = Permutation(px[i] + py[j] + Pi.z + oi); // pij1, pij2, pij3
+
+ ox = frac(p * K) - Ko;
+ oy = mod(floor(p * K), 7.0) * K - Ko;
+
+ p = Permutation(p);
+
+ oz = frac(p * K) - Ko;
+
+ dx = Pf.x - of[i] + jitter * ox;
+ dy = Pf.y - of[j] + jitter * oy;
+ dz = Pf.z - of + 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 ++)
+ {
+ if (d[n] < F[0])
+ {
+ F[1] = F[0];
+ F[0] = d[n];
+ randomPoint = p;
+ }
+ else if(d[n] < F[1])
+ {
+ F[1] = d[n];
+ }
+ }
+ }
+ }
+
+ return F;
+ }
+
+ float voronoi2D(in float2 x, float scale, float2 speed)
+ {
+ 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;
+ for (int j = -1; j <= 1; j ++)
+ {
+ for (int i = -1; i <= 1; i ++)
+ {
+ 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;
+ mr = r;
+ mg = g;
+ randomPoint.xy = currentPoint;
+ }
+ }
+ }
+
+ // second pass: distance to borders
+ md = 8.0;
+ for (int r = -2; r <= 2; r ++)
+ {
+ for (int q = -2; q <= 2; q ++)
+ {
+ 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)));
+ }
+ }
+ }
+ return md;
+ }
+
+ float voronoi3D(in float3 x, float scale, float3 speed)
+ {
+ 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;
+ for (int j = -1; j <= 1; j ++)
+ {
+ for (int i = -1; i <= 1; i ++)
+ {
+ for (int h = -1; h <= 1; h ++)
+ {
+ 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;
+ mr = r;
+ mg = g;
+ randomPoint = currentPoint;
+ }
+ }
+ }
+ }
+
+ // second pass: distance to borders
+ md = 8.0;
+ for (int r = -2; r <= 2; r ++)
+ {
+ for (int q = -2; q <= 2; q ++)
+ {
+ for (int p = -2; p <= 2; p ++)
+ {
+ 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)));
+ }
+ }
+ }
+ }
+ 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)
+ {
+ float freq = scale;
+ float weight = 1.0f;
+ float sum = 0;
+ for (int i = 0; i < octaveNumber; i ++)
+ {
+ float2 F = inoise(p * freq + time * speed, jitter) * 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)
+ {
+ float freq = scale;
+ float weight = 1.0f;
+ float sum = 0;
+ for (int i = 0; i < octaveNumber; i ++)
+ {
+ float2 F = inoise(p * freq + time * speed, jitter) * weight;
+
+ sum += sqrt(F[1]) - sqrt(F[0]);
+
+ freq *= octaveScale;
+ weight *= 1.0f - octaveAttenuation;
+ }
+ return sum;
+ }
+
+ void applyVoronoi(inout float4 finalColor, inout float3 VoronoiEmission)
+ {
+ float voronoiOctaveNumber = 1;
+ float voronoiOctaveScale = 1;
+ float voronoiOctaveAttenuation = 1;
+ randomPoint = 0;
+ float4 voronoiColor1 = _VoronoiColor1;
+
+ float voronoi = 0;
+
+ float3 position = 0;
+
+ UNITY_BRANCH
+ if (_VoronoiSpace == 0)
+ {
+ position = poiMesh.localPos;
+ }
+ UNITY_BRANCH
+ if(_VoronoiSpace == 1)
+ {
+ position = poiMesh.worldPos;
+ }
+ UNITY_BRANCH
+ if(_VoronoiSpace == 2)
+ {
+ position = float3(poiMesh.uv[0].x, poiMesh.uv[0].y, 0);
+ }
+ #if defined(PROP_VORONOIMASK) || !defined(OPTIMIZER_ENABLED)
+ float mask = POI2D_SAMPLER_PAN(_VoronoiMask, _MainTex, poiMesh.uv[_VoronoiMaskUV], _VoronoiMaskPan).r;
+ #else
+ float mask = 1;
+ #endif
+ #if defined(PROP_VORONOINOISE) || !defined(OPTIMIZER_ENABLED)
+ float edgeNoise = POI2D_SAMPLER_PAN(_VoronoiNoise, _MainTex, poiMesh.uv[_VoronoiNoiseUV], _VoronoiNoisePan).r * _VoronoiNoiseIntensity;
+ #else
+ float edgeNoise = 0;
+ #endif
+ UNITY_BRANCH
+ if(_VoronoiType == 0) // Basic
+ {
+ voronoi = voronoi2D(position.xy, _VoronoiScale, _VoronoiSpeed);
+ }
+ UNITY_BRANCH
+ if (_VoronoiType == 1) // Diff
+ {
+ voronoi = VoronoiNoiseDiff_Octaves(position, _VoronoiScale, _VoronoiSpeed, voronoiOctaveNumber, voronoiOctaveScale, voronoiOctaveAttenuation, 1, _Time.x);
+ }
+ UNITY_BRANCH
+ if (_VoronoiType == 2) // Fixed Border
+ {
+ voronoi = voronoi3D(position, _VoronoiScale, _VoronoiSpeed);
+ // isolines
+ //color = c.x * (0.5 + 0.5 * sin(64.0 * c.x)) * 1.0;
+ }
+
+ if (_VoronoiEnableRandomCellColor == 1)
+ {
+ float3 rando = random3(randomPoint);
+ fixed hue = rando.x;
+ fixed saturation = lerp(_VoronoiRandomMinMaxSaturation.x, _VoronoiRandomMinMaxSaturation.y, rando.y);
+ fixed value = lerp(_VoronoiRandomMinMaxBrightness.x, _VoronoiRandomMinMaxBrightness.y, rando.z);
+ float3 hsv = float3(hue, saturation, value);
+
+ voronoiColor1.rgb = HSVtoRGB(hsv);
+ }
+
+ float2 voronoiGradient = _VoronoiGradient;
+ voronoiGradient.xy += edgeNoise;
+ float ramp = smoothstep(voronoiGradient.x, voronoiGradient.y, voronoi);
+
+ UNITY_BRANCH
+ if(_VoronoiBlend == 0)
+ {
+ float4 voronoiColor = lerp(_VoronoiColor0, voronoiColor1, ramp);
+ UNITY_BRANCH
+ if(_VoronoiEffectsMaterialAlpha)
+ {
+ finalColor.rgba = lerp(finalColor, voronoiColor, min(mask, 0.99999));
+ }
+ else
+ {
+ finalColor.rgb = lerp(finalColor.rgb, voronoiColor.rgb, min(mask * voronoiColor.a, 0.99999));
+ }
+ }
+ float4 voronoiEmissionColor = lerp(_VoronoiColor0 * _VoronoiEmission0, voronoiColor1 * _VoronoiEmission1, ramp);
+ VoronoiEmission = voronoiEmissionColor.rgb * mask * voronoiEmissionColor.a;
+ }
+
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVoronoi.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVoronoi.cginc.meta
new file mode 100644
index 00000000..59241830
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiVoronoi.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e434761b466d9634bb3659a0b8ec52b8
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiWireframe.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiWireframe.cginc
new file mode 100644
index 00000000..1f56e6e6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiWireframe.cginc
@@ -0,0 +1,111 @@
+#ifndef POI_WIREFRAME
+ #define POI_WIREFRAME
+
+ UNITY_DECLARE_TEX2D_NOSAMPLER(_WireframeTexture); float4 _WireframeTexture_ST;
+ float2 _WireframeTexturePan;
+ float _WireframeSmoothing;
+ float _WireframeThickness;
+ float4 _WireframeColor;
+ float _WireframeAlpha;
+ float _WireframeEnable;
+ float _WireframeWaveEnabled;
+ float _WireframeWaveDensity;
+ float _WireframeWaveSpeed;
+ float _WireframeEdgeOpacity;
+ float _WireframeFaceOpacity;
+ half _WireframeEmissionAlpha;
+ float _WireframeEmissionStrength;
+ float _WireframeQuad;
+ float _WireframeUV;
+
+ #ifndef POI_SHADOW
+ void applyWireframe(inout float3 wireframeEmission, inout float4 albedo)
+ {
+ UNITY_BRANCH
+ if (_WireframeEnable)
+ {
+ float4 colorMap = UNITY_SAMPLE_TEX2D_SAMPLER(_WireframeTexture, _MainTex, TRANSFORM_TEX(poiMesh.uv[_WireframeUV], _WireframeTexture) + _Time.x * _WireframeTexturePan);
+ float size = _WireframeThickness;
+ half3 width = abs(ddx(poiMesh.barycentricCoordinates)) + abs(ddy(poiMesh.barycentricCoordinates));
+ half3 eF = smoothstep(0, width * size, poiMesh.barycentricCoordinates);
+ half minBary = size > 0 ? min(min(eF.x, eF.y), eF.z): 1;
+
+ float4 wireframeColor = _WireframeColor * colorMap;
+
+ albedo.a *= lerp(_WireframeEdgeOpacity, _WireframeFaceOpacity, minBary);
+ albedo.rgb = lerp(lerp(albedo.rgb, wireframeColor.rgb, wireframeColor.a), albedo.rgb, minBary);
+ wireframeEmission = wireframeColor.rgb * _WireframeEmissionStrength * (1 - minBary) * _WireframeColor.a;
+ }
+ }
+
+ [maxvertexcount(3)]
+ void wireframeGeom(triangle v2f IN[3], inout TriangleStream < v2f > tristream)
+ {
+ UNITY_BRANCH
+ if(_WireframeQuad)
+ {
+ float e1 = length(IN[0].localPos - IN[1].localPos);
+ float e2 = length(IN[1].localPos - IN[2].localPos);
+ float e3 = length(IN[2].localPos - IN[0].localPos);
+
+ float3 quad = 0;
+ if(e1 > e2 && e1 > e3)
+ quad.y = 1.;
+ else if(e2 > e3 && e2 > e1)
+ quad.x = 1;
+ else
+ quad.z = 1;
+
+ IN[0].barycentricCoordinates = fixed3(1, 0, 0) + quad;
+ IN[1].barycentricCoordinates = fixed3(0, 0, 1) + quad;
+ IN[2].barycentricCoordinates = fixed3(0, 1, 0) + quad;
+ }
+ else
+ {
+ IN[0].barycentricCoordinates = fixed3(1, 0, 0);
+ IN[1].barycentricCoordinates = fixed3(0, 1, 0);
+ IN[2].barycentricCoordinates = fixed3(0, 0, 1);
+ }
+
+
+
+ tristream.Append(IN[0]);
+ tristream.Append(IN[1]);
+ tristream.Append(IN[2]);
+ }
+ #else
+
+ float applyShadowWireframe(float2 uv, float3 barycentricCoordinates, float3 normal, float3 worldPos)
+ {
+ UNITY_BRANCH
+ if(_WireframeEnable)
+ {
+ float wireframeFadeAlpha = _WireframeAlpha;
+ float3 finalWireframeColor = 0;
+
+ float3 barys;
+ barys.xy = barycentricCoordinates;
+ barys.z = 1 - barys.x - barys.y;
+ float3 deltas = fwidth(barys);
+ float3 smoothing = deltas * _WireframeSmoothing;
+ float wireframeThickness = _WireframeThickness;
+ float3 thickness = deltas * wireframeThickness;
+ barys = smoothstep(thickness, thickness + smoothing, barys);
+ float minBary = min(barys.x, min(barys.y, barys.z));
+
+ return lerp(_WireframeEdgeOpacity, _WireframeFaceOpacity, minBary);
+ }
+ }
+
+ [maxvertexcount(3)]
+ void wireframeGeom(triangle V2FShadow IN[3], inout TriangleStream < V2FShadow > tristream)
+ {
+ IN[0].barycentricCoordinates = fixed3(1, 0, 0);
+ IN[1].barycentricCoordinates = fixed3(0, 1, 0);
+ IN[2].barycentricCoordinates = fixed3(0, 0, 1);
+ tristream.Append(IN[0]);
+ tristream.Append(IN[1]);
+ tristream.Append(IN[2]);
+ }
+ #endif
+#endif \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiWireframe.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiWireframe.cginc.meta
new file mode 100644
index 00000000..6a7b4507
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_PoiWireframe.cginc.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 65110f189ab785a48b0a0d99d987ea15
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_Poicludes.cginc b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_Poicludes.cginc
new file mode 100644
index 00000000..4ae8cc7d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_Poicludes.cginc
@@ -0,0 +1,172 @@
+#ifndef POICLUDES
+#define POICLUDES
+
+UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST; float4 _MainTex_TexelSize;
+float _SpecularLMOcclusion;
+float _SpecLMOcclusionAdjust;
+sampler2D _PoiGrab;
+sampler2D _CameraDepthTexture;
+float _Cutoff;
+float _AlphaMod;
+
+//Structs
+struct appdata
+{
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+};
+
+#ifdef OUTLINE
+ float _LineWidth;
+ float _OutlineEmission;
+ float4 _LineColor;
+ sampler2D _OutlineTexture; float4 _OutlineTexture_ST; float2 _OutlineTexturePan; float _OutlineTextureUV;
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+#endif
+
+struct PoiLighting
+{
+ half3 direction;
+ half3 color;
+ fixed attenuation;
+ #ifdef FORWARD_ADD_PASS
+ fixed additiveShadow;
+ #endif
+ half3 directLighting;
+ half3 indirectLighting;
+ half lightMap;
+ float3 rampedLightMap;
+ half3 finalLighting;
+ half3 halfDir;
+ half nDotL;
+ half nDotH;
+ half lDotv;
+ half lDotH;
+ half nDotV;
+ half N0DotV;
+ half diffuseTerm;
+ half occlusion;
+ half dotNH;
+ half dotLH;
+
+ #ifdef VERTEXLIGHT_ON
+ // Non Important Lights
+ float4 vDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vDotLH;
+
+
+ #endif
+};
+
+struct PoiCamera
+{
+ half3 viewDir;
+ half3 tangentViewDir;
+ half3 decalTangentViewDir;
+ half3 forwardDir;
+ half3 worldPos;
+ float viewDotNormal;
+ float distanceToModel;
+ float distanceToVert;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float2 screenUV;
+ float4 clipPos;
+ #if defined(GRAIN)
+ float4 worldDirection;
+ #endif
+ float4 grabPos;
+};
+
+struct PoiMesh
+{
+ float3 normals[2];
+ float4 tangent;
+ float3 binormal;
+ float3 localPos;
+ float3 worldPos;
+ float3 modelPos;
+ float3 tangentSpaceNormal;
+ float2 uv[5];
+ float4 vertexColor;
+ fixed3 barycentricCoordinates;
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ float4 lightmapUV;
+ #endif
+ float isFrontFace;
+ #ifdef FUR
+ float furAlpha;
+ #endif
+};
+
+struct PoiTangentData
+{
+ float3x3 tangentTransform;
+ float3x3 tangentToWorld;
+};
+
+struct FragmentCommonData
+{
+ half3 diffColor, specColor;
+ // Note: smoothness & oneMinusReflectivity for optimization purposes, mostly for DX9 SM2.0 level.
+ // Most of the math is being done on these (1-x) values, and that saves a few precious ALU slots.
+ half oneMinusReflectivity, smoothness;
+ float3 normalWorld;
+ float3 eyeVec;
+ half alpha;
+ float3 posWorld;
+
+ #if UNITY_STANDARD_SIMPLE
+ half3 reflUVW;
+ #endif
+
+ #if UNITY_STANDARD_SIMPLE
+ half3 tangentSpaceNormal;
+ #endif
+};
+
+struct Debug
+{
+ float debug1;
+ float2 debug2;
+ float3 debug3;
+ float4 debug4;
+};
+
+struct PoiMods
+{
+ float4 audioLink;
+ fixed audioLinkTextureExists;
+ float4 globalMasks;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+};
+
+static Debug debug;
+static PoiLighting poiLight;
+static PoiCamera poiCam;
+static PoiMesh poiMesh;
+static PoiMods poiMods;
+static UnityGI gi;
+static FragmentCommonData s;
+static PoiTangentData poiTData;
+
+#endif
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_Poicludes.cginc.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_Poicludes.cginc.meta
new file mode 100644
index 00000000..f1877049
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/CGI_Poicludes.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d0e3e8cd70bfa154ab69be067aba0d59
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/Notes.txt b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/Notes.txt
new file mode 100644
index 00000000..ec2c5bfd
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/Notes.txt
@@ -0,0 +1,7 @@
+// Transforms 2D UV by scale/bias property
+#define TRANSFORM_TEX(tex,name) (tex.xy * name##_ST.xy + name##_ST.zw)
+
+[HideInInspector][Vector2]Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] UV ("UV", Int) = 0
+
+:=--{reference_properties:[Pan, UV]} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/Notes.txt.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/Notes.txt.meta
new file mode 100644
index 00000000..53bab679
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Includes/Notes.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 572baf09485ff2d4b9e074da2bba81bb
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders.meta
new file mode 100644
index 00000000..10106176
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b1e88d4461f0ec646b7b5b2d06efbbba
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/7PlusLabels.txt b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/7PlusLabels.txt
new file mode 100644
index 00000000..214ab5e0
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/7PlusLabels.txt
@@ -0,0 +1,233 @@
+--{reference_property:REFERENCEA,button_help:{text:Tutorial,action:{type:URL,data:URLSTRING},hover:YouTube}}
+THINGASD:=NAMESD--{hide_in_inspector:true}
+
+reference_property:REFERENCEA,
+
+--{reference_property:REFERENCEA}
+:=--{reference_property:REFERENCEA}
+
+--{button_help:{text:Tutorial,action:{type:URL,data:URLSTRING},hover:YouTube}}
+
+--{hide_in_inspector:true}
+
+// Main
+m_mainOptions:=Main--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=5yxREJE8DPA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}
+_MainTex:=Main Texture--{reference_properties:[_MainTexPan, _MainTextureUV]}
+_BumpMap:=Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV]}
+_VertexManipulationHeightMask:=Height Map--{reference_properties:[_VertexManipulationHeightPan, _VertexManipulationHeightUV]}
+_BackFaceTexture:= Texture--{reference_properties:[_BackFacePanning, _BackFaceTextureUV]}
+
+m_start_MainVertexColors:=Vertex Colors
+
+// RGB Mask
+m_start_RGBMask:=RGBA Color Masking--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=VVJ9Ac1_fXk&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_RGBMaskEnabled}
+_RGBMask:=RGBA Mask--{reference_properties:[_RGBMaskPanning, _RGBMaskUV]}
+_RedTexure:=R Texture--{reference_properties:[_RGBRedPanning, _RGBRed_UV]}
+_GreenTexture:=G Texture--{reference_properties:[_RGBGreenPanning, _RGBGreen_UV]}
+_BlueTexture:=B Texture--{reference_properties:[_RGBBluePanning, _RGBBlue_UV]}
+_AlphaTexture:=A Texture--{reference_properties:[_RGBAlphaPanning, _RGBAlpha_UV]}
+
+// Hue Shift
+m_start_MainHueShift:=Color Adjust--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=Asj7u0Wd5T4&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_MainHueShiftToggle}
+_MainHueShiftMask:=Mask--{reference_properties:[_MainHueShiftMaskPan, _MainHueShiftMaskUV]}
+
+// Details
+_DetailMask:=Detail Mask--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}
+_DetailTex:=Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}
+_DetailNormalMap:=Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV]}
+
+// Alpha Options
+m_start_Alpha:=Alpha Options--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=kP4KFOd6P6o&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}
+
+// Backface
+m_start_backFace:=Back Face--{reference_property:_BackFaceEnabled,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=uZnNpiCvsDg&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}
+_BackFaceEnabled:=Back Face--{hide_in_inspector:true}
+_BackFaceTexture:=Backface Texture--{reference_properties:[_BackFacePanning, _BackFaceTextureUV]}
+
+// Lighting
+m_lightingOptions:=Lighting & Reflections
+m_start_Lighting:=Light & Shadow--{reference_property:_EnableLighting,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=TxVmCYkH8CM&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw&index=11&t=0s},hover:YouTube}}
+_EnableLighting:=Light & Shadow--{hide_in_inspector:true}
+_LightingAOTex:=AO Map--{reference_properties:[_LightingAOTexPan, _LightingAOTexUV]}
+
+// Subsurface Scattering
+m_start_subsurface:=Subsurface Scattering--{reference_property:_EnableSSS,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=WZ1fmFMVk0U&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}
+_EnableSSS:=Subsurface Scattering--{hide_in_inspector:true}
+
+_ToonRamp1:=Lighting Ramp 2--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true}
+_ToonRamp2:=Lighting Ramp 3--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true}
+_ToonRamp3:=Lighting Ramp 4--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true}
+
+m_start_lightingStandard:=Standardish Settings
+
+// Rim Lighting
+m_start_rimLightOptions:=Rim Lighting--{reference_property:_EnableRimLighting,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=RE2eWlpdTm8&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}
+_EnableRimLighting:=Rim Lighting--{hide_in_inspector:true}
+_RimTex:=Rim Texture--{reference_properties:[_RimTexPan]}
+_RimTex:=Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV]}
+_RimMask:=Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV]}
+_RimWidthNoiseTexture:=Width Noise--{reference_properties:[_RimWidthNoiseTexturePan, _RimWidthNoiseTextureUV]}
+
+// Environmental Rim Lighting
+m_start_reflectionRim:=Environmental Rim Lighting--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=R1LTIjzk-WM&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_EnableEnvironmentalRim}
+_EnableEnvironmentalRim:=Environmental Rim Lighting--{hide_in_inspector:true}
+_RimEnviroMask:=Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}
+
+m_start_bakedLighting:=Baked Lighting
+
+// Reflections
+m_reflectionOptions:=Reflections
+// Metal
+m_start_Metallic:=Metallics (Deprecated)--{reference_property:_EnableMetallic,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=uSoj9eEFhPY&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}
+_EnableMetallic:=Metallics--{hide_in_inspector:true}
+_MetallicMask:=Metallic Map--{reference_properties:[_MetallicMaskPan, _MetallicMaskUV]}
+_MetallicTintMap:=RGB Tint A Mask--{reference_properties:[_MetallicTintMapPan, _MetallicTintMapUV]}
+_SmoothnessMask:=Smoothness Map--{reference_properties:[_SmoothnessMaskPan, _SmoothnessMaskUV]}
+
+// Clear Coat
+m_start_clearCoat:=Clear Coat--{reference_property:_EnableClearCoat,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=HtbLCfgzFlg&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}
+_EnableClearCoat:=Clear Coat--{hide_in_inspector:true}
+
+// Matcap
+m_start_matcap:=Matcap--{reference_property:_MatcapEnable,button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/DFo87kuO1OI},hover:YouTube}}
+_MatcapEnable:=Matcap--{hide_in_inspector:true}
+m_start_Matcap2:=Matcap 2--{reference_property:_Matcap2Enable,button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/DFo87kuO1OI},hover:YouTube}}
+_Matcap2Enable:=Matcap 2--{hide_in_inspector:true}
+
+// Specular
+m_start_specular:=Specular Reflections--{reference_property:_EnableSpecular,button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/YFFe8IrXVnc},hover:YouTube}}
+_EnableSpecular:=Specular Reflections--{hide_in_inspector:true}
+_SpecularMap:=Spec Map--{reference_properties:[_SpecularMapPan, _SpecularMapUV]}
+_SpecularMask:=Spec Mask--{reference_properties:[_SpecularMaskPan, _SpecularMaskUV]}
+
+// Specular 2
+m_start_specular1:=Specular Reflections 2--{reference_property:_EnableSpecular1,button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/YFFe8IrXVnc},hover:YouTube}}
+_EnableSpecular1:=Specular Reflections 2--{hide_in_inspector:true}
+_SpecularMap1:=Spec Map--{reference_properties:[_SpecularMap1Pan, _SpecularMap1UV]}
+_SpecularMask1:=Spec Mask--{reference_properties:[_SpecularMask1Pan, _SpecularMask1UV]}
+m_start_SpecularToon1:=Toon Specular
+m_start_Anisotropic1:=Anisotropic
+
+m_outlineOptions:=Outlines--{reference_property:_commentIfZero_EnableOutlinePass}
+_commentIfZero_EnableOutlinePass:=Enable Outlines--{hide_in_inspector:true}
+
+m_start_outlineAdvanced:=Advanced
+
+// Special Effects
+m_Special_Effects:=Special Effects
+
+// Emission
+m_emissionOptions:= Emission--{reference_property:_EnableEmission,button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/iqk23gtwkz0},hover:YouTube}}
+m_start_emissionOptions:=Emission--{reference_property:_EnableEmission,button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/iqk23gtwkz0},hover:YouTube}}
+_EnableEmission:=Emission--{hide_in_inspector:true}
+_EmissionMap:=Emission Map--{texture:{width:1224,height:4,filterMode:Bilinear,wrapMode:Repeat},reference_properties:[_EmissionMapPan, _EmissionMapUV], force_texture_options:true}
+_EmissionMask:=Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV]}
+_EmissionMap1:=Emission Map--{texture:{width:1224,height:4,filterMode:Bilinear,wrapMode:Repeat},reference_properties:[_EmissionMap1Pan, _EmissionMap1UV], force_texture_options:true}
+_EmissionMask1:=Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV]}
+m_start_CenterOutEmission:=Center Out Emission--{reference_property:_EmissionCenterOutEnabled}
+m_start_glowInDarkEmissionOptions:=Glow In The Dark Emission (Requires Lighting Enabled)--{reference_property:_EnableGITDEmission}
+m_start_blinkingEmissionOptions:=Blinking Emission--{reference_property:_EmissionBlinkingEnabled}
+m_start_scrollingEmissionOptions:=Scrolling Emission--{reference_property:_ScrollingEmission}
+
+
+m_start_emission1Options:=Emission 2(Requires Emission 1 Enabled)--{reference_property:_EnableEmission1}
+_EnableEmission1:=Emission 2(Requires Emission 1 Enabled)--{hide_in_inspector:true}
+m_start_CenterOutEmission1:=Center Out Emission--{reference_property:_EmissionCenterOutEnabled1}
+m_start_glowInDarkEmissionOptions1:=Glow In The Dark Emission (Requires Lighting Enabled)--{reference_property:_EnableGITDEmission1}
+m_start_blinkingEmissionOptions1:=Blinking Emission--{reference_property:_EmissionBlinkingEnabled1}
+m_start_scrollingEmissionOptions1:=Scrolling Emission--{reference_property:_ScrollingEmission1}
+
+// Flipbook
+m_start_flipBook:=Flipbook--{reference_property:_EnableFlipbook,button_help:{reference_property:_EnableFlipbook,text:Tutorial,action:{type:URL,data:https://youtu.be/NrA18CITEVs},hover:YouTube}}
+_EnableFlipbook:=Flipbook--{hide_in_inspector:true}
+m_start_manualFlipbookControl:=Manual Frame Control
+_FlipbookTexArray:=Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}
+_FlipbookMask:=Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}
+
+// Dissolve
+m_start_dissolve:=Dissolve--{reference_property:_EnableDissolve,button_help:{reference_property:_EnableDissolve,text:Tutorial,action:{type:URL,data:https://youtu.be/abTejmV4yGU},hover:YouTube}}
+_EnableDissolve:=Dissolve--{hide_in_inspector:true}
+m_start_pointToPoint:=Point to Point
+_DissolveToTexture:=Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}
+_DissolveNoiseTexture:=Dissolve Noise--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}
+_DissolveDetailNoise:=Dissolve Detail Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}
+_DissolveMask:=Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV, _DissolveMaskInvert]}
+
+// Panosphere
+m_start_panosphereOptions:=Panosphere--{reference_property:_PanoToggle,button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/wyCY6qE0_Vg},hover:YouTube}}
+_PanoToggle:=Panosphere--{hide_in_inspector:true}
+_PanoMask:=Mask--{reference_properties:[_PanoMaskPan, _PanoMaskUV]}
+
+// Glitter
+m_start_glitter:=Glitter--{reference_property:_GlitterEnable}
+_GlitterEnable:=Glitter--{hide_in_inspector:true}
+_GlitterColorMap:=Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}
+_GlitterMask:=Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}
+
+// MSDF
+m_start_Text:=Text Overlay--{reference_property:_TextEnabled}
+_TextEnabled:=Text Overlay--{hide_in_inspector:true}
+m_start_TextFPS:=FPS--{reference_property:_TextFPSEnabled}
+_TextFPSEnabled:=FPS --{hide_in_inspector:true}
+m_start_TextPosition:=Position--{reference_property:_TextPositionEnabled}
+_TextPositionEnabled:=Position--{hide_in_inspector:true}
+m_start_TextInstanceTime:=Instance Time--{reference_property:_TextTimeEnabled}
+_TextTimeEnabled:=Instance Time--{hide_in_inspector:true}
+
+// Mirror Options
+m_start_mirrorOptions:=Mirror (VRChat)--{reference_property:_EnableMirrorOptions,button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/ptnVKyuijO4},hover:YouTube}}
+_EnableMirrorOptions:=Mirror (VRChat)--{hide_in_inspector:true}
+_MirrorTexture:=Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]}
+
+// Angular Fade
+m_start_angularFade:=Angular Fade--{reference_property:_EnableRandom}
+_EnableRandom:=Angular Fade--{hide_in_inspector:true}
+// Optimization
+m_optimization:=Optimization
+
+m_ParallaxMap:=Parallax--{reference_property:_ParallaxMap}
+_ParallaxMap:=Parallax--{hide_in_inspector:true}
+
+_ParallaxHeightMap:=Height Map--{reference_properties:[_ParallaxHeightMapPan]}
+
+m_start_parallaxHeightmap:=Heightmap--{reference_property:_ParallaxHeightMapEnabled}
+_ParallaxHeightMapEnabled:=Heightmap--{hide_in_inspector:true}
+
+m_start_parallaxInternal:=Internal Parallax--{reference_property:_ParallaxInternalMapEnabled}
+_ParallaxInternalMapEnabled:=Internal Parallax--{hide_in_inspector:true}
+
+_ParallaxHeightMapMask:=Mask--{reference_properties:[_ParallaxHeightMapMaskPan, _ParallaxHeightMapMaskUV]}
+_ParallaxInternalMapMask:=Mask--{reference_properties:[_ParallaxInternalMapMaskPan, _ParallaxInternalMapMaskUV]}
+
+m_start_parallaxAdvanced:=Advanced
+
+
+m_start_distortionFlow:=UV Distortion--{reference_property:_EnableDistortion,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=J17a3glPMYI&t=1s},hover:YouTube}}
+_EnableDistortion:=UV Distortion--{hide_in_inspector:true}
+
+
+// Touch
+m_start_TouchOptions:=Touch FX--(Requires DepthGet Prefab)
+
+
+m_start_FresnelAlpha:=Fresnel Alpha
+_HoloAlphaMap:=Alpha Maptexture--{width:1024,height:4,filterMode:Bilinear,wrapMode:Repeat},force_texture_options:true}
+
+// Voronoi
+_VoronoiMask:=Mask--{reference_properties:[_VoronoiMaskPan, _VoronoiMaskUV]}
+_VoronoiNoise:=Edge Noise--{reference_properties:[_VoronoiNoisePan, _VoronoiNoiseUV]}
+
+m_renderingOptions:=Rendering Options--{button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/P5KlE9rk9pg},hover:YouTube}}
+m_start_StencilPassOptions:=Stencil--{button_help:{text:Tutorial,action:{type:URL,data:https://youtu.be/uniOEpw88jk},hover:YouTube}}
+
+
+m_start_debugOptions:=Debug--{reference_property:_DebugEnabled}
+
+m_animationToggles:=Animation Support Toggles
+
+// Footer
+footer_youtube:={texture:{name:icon-youtube,height:32},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}
+footer_twitter:={texture:{name:icon-twitter,height:32},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}
+footer_patreon:={texture:{name:icon-patreon,height:32},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}
+footer_discord:={texture:{name:icon-discord,height:32},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}
+footer_github:={texture:{name:icon-github,height:32},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/7PlusLabels.txt.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/7PlusLabels.txt.meta
new file mode 100644
index 00000000..4e848c2b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/7PlusLabels.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: d91e0db3d0441454e8f7d1d26d2ec2e4
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/PatchNotes.poi b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/PatchNotes.poi
new file mode 100644
index 00000000..f1244642
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/PatchNotes.poi
@@ -0,0 +1,21 @@
+
+**[7.3.028]**
+**[Bug Fix]** Glow in the dark mesh or world was being shared between emission 1 and 2
+**[Bug Fix]** Fixed a weird glow in the dark bug that changed the color of emission in specific cases @Lupsoris#0001
+
+
+// to do
+panosphere UV
+Hue shift for outline not changing emission color https://discordapp.com/channels/550477546958094348/550477704617787422/865060339828785154
+audio link average volume
+Grab pass nan explosions in 2019
+audio link features
+Light Based glitter
+Merge iridescence with matcap
+Audio Link Glitter more than normal integration
+SDF
+Special FX master shader
+audio link matcap emission strength
+Vertex Color color for outline
+// Videos to make
+RGBA what does it mean \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/PatchNotes.poi.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/PatchNotes.poi.meta
new file mode 100644
index 00000000..8c347888
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/PatchNotes.poi.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 0a60b55a96f35834fa99cd038e615790
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro.shader
new file mode 100644
index 00000000..f4f376d9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro.shader
@@ -0,0 +1,1996 @@
+Shader ".poiyomi/Poiyomi 7.3/★ Poiyomi Pro ★"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi Pro V7.3.050</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+ [HideInInspector] shader_properties_label_file ("7PlusLabels", Float) = 0
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _MainTex ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainTextureUV ("UV", Int) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ClippingMaskUV ("UV", Int) = 0
+ [ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+
+ //Hue Shifting
+ [HideInInspector] m_start_MainHueShift ("Color Adjust", Float) = 0
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?", Float) = 1
+ _MainHueShift ("Hue Shift", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed", Float) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness("Brightness", Range(-1,1)) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)]_MainHueShiftToggle ("Toggle Hueshift", Float) = 0
+ _MainColorAdjustTexture ("Mask R(H) G(S) B(B)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ _RGBMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBMaskPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color", Color) = (1, 1, 1, 1)
+ _RedTexure ("R Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBRedPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBRed_UV ("UV", int) = 0
+ _GreenColor ("G Color", Color) = (1, 1, 1, 1)
+ _GreenTexture ("G Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBGreenPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBGreen_UV ("UV", int) = 0
+ _BlueColor ("B Color", Color) = (1, 1, 1, 1)
+ _BlueTexture ("B Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBBluePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBBlue_UV ("UV", int) = 0
+ _AlphaColor ("A Color", Color) = (1, 1, 1, 1)
+ _AlphaTexture ("A Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBAlphaPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBAlpha_UV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalRPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalGPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalBPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalAPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Detail Options
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=9oIcQln9of4&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture Tint", Color) = (1, 1, 1)
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ // Vertex Colors
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ //Vertex Manipulations
+ [HideInInspector] m_start_vertexManipulation ("Vertex Offset--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Division Amount", Float) = 500
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ // Alpha Options
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ _Cutoff ("Alpha Cuttoff", Range(0, 1.001)) = 0.5
+ [ToggleUI]_DitheringEnabled ("Enable Dithering", Float) = 0
+ _DitherGradient ("Dither Gradient", Range(0, 1)) = .1
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 0
+ _MainShadowClipMod ("Shadow Clip Mod", Range(-1, 1)) = 0
+ [Enum(Off, 0, On, 1)] _AlphaToMask ("Alpha To Coverage", Float) = 0
+ [ToggleUI]_MainAlphaToCoverage ("Sharpenned A2C--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Float) = 0
+ _MainMipScale ("Mip Level Alpha Scale--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Range(0, 1)) = 0.25
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_DecalEnabled}", Float) = 0
+ _DecalMask ("Decal RGBA Mask--{reference_properties:[_DecalMaskPan, _DecalMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalMaskUV ("UV", Int) = 0
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ _DecalColor ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed", Float) = 0
+ _DecalHueShift ("Hue Shift", Range(0,1)) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ _DecalColor1 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled1 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed", Float) = 0
+ _DecalHueShift1 ("Hue Shift", Range(0,1)) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ _DecalColor2 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled2 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed", Float) = 0
+ _DecalHueShift2 ("Hue Shift", Range(0,1)) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ _DecalColor3 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled3 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed", Float) = 0
+ _DecalHueShift3 ("Hue Shift", Range(0,1)) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face", Float) = 0
+ [ToggleUI]_BackFaceEnabled ("Enable Back Face Options", Float) = 0
+ _BackFaceColor ("Color", Color) = (1, 1, 1, 1)
+ _BackFaceTexture ("Texture", 2D) = "white" { }
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ [HideInInspector][Vector2]_BackFacePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ _BackFaceHueShift ("Hue Shift", Range(0, 1)) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingOptions ("Lighting", Float) = 0
+ [HideInInspector] m_start_Lighting ("Light and Shadow", Float) = 0
+ [Toggle(VIGNETTE_MASKED)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Toon, 0, Realistic, 1, Wrapped (Beta), 2, Skin (Beta), 3, Flat, 4)] _LightingMode ("Lighting Type", Int) = 4
+ _LightingStandardSmoothness ("Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==1}}", Range(0, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}", Range(0, 1)) = 0
+ [Enum(Ramp Texture, 0, Math Gradient, 1, Shade Mapping, 2)] _LightingRampType ("Ramp Type--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}}}}", Int) = 0
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Color) = (1,1,1,1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", 2D) = "white" {}
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask("1st ShadeMap.a As ShadowMask", Float ) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse("1st ShadeMapMask Inverse", Float ) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}}", Float ) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Color) = (1,1,1,1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", 2D) = "white" {}
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask("2nd ShadeMap.a As ShadowMask", Float ) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse("2nd ShadeMapMask Inverse", Float ) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Float ) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.01, 1)) = 0
+ _1st2nd_Shades_Feather ("1st/2nd_Shades_Feather--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.0001, 1)) = 0.0001
+
+ // Ramp
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==0}}}", 2D) = "white" { }
+ _LightingShadowMask ("Ramp Mask--{reference_properties:[_LightingShadowMaskPan, _LightingShadowMaskUV],condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingShadowMaskUV ("UV", Int) = 0
+ _ShadowOffset ("Ramp Offset--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==0}}}}", Range(-1, 1)) = 0
+ //Math
+ _LightingGradientStart ("Gradient Start--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==1}}}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==1}}}", Range(0, 1)) = .5
+ // Skin
+ _SkinLUT ("LUT--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", 2D) = "white" {}
+ //_SssMaskCutoff ("Mask Cutoff--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0.01,1)) = 0.1
+ //_SssBias ("Bias--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 0
+ _SssScale ("Scale--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 0.7
+ [HideInInspector][Vector3]_SssTransmissionAbsorption ("Absorption--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Vector) = (-8,-40,-64,0)
+ [HideInInspector][Vector3]_SssColorBleedAoWeights ("AO Color Bleed--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Vector) = (0.4,0.15,0.13,0)
+ _LightingShadowColor ("Shadow Tint--{reference_property:_LightingDetailShadowsEnabled, condition_showS:(_LightingMode==0&&_LightingRampType!=2)||_LightingMode==2||_LightingMode==3}", Color) = (1, 1, 1, 1)
+ _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode==0&&_LightingRampType!=2)||_LightingMode==2}", Range(0, 1)) = 1
+ _AttenuationMultiplier ("Receive Casted Shadows--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode!=4}}", Range(0, 1)) = 0
+ [ToggleUI]_LightingIgnoreAmbientColor ("Ignore Ambient Color--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode!=4},condition2:{type:PROPERTY_BOOL,data:_LightingMode!=1}}}", Float) = 0
+
+ //_LightingShadowMap ("Shadow Color(RGB) and wrap(A)--{reference_properties:[_LightingShadowMapPan, _LightingShadowMapUV],condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}}", 2D) = "white" { }
+ //[HideInInspector][Vector2]_LightingShadowMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ //[HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingShadowMapUV ("UV", Int) = 0
+
+ [HideInInspector] m_start_lightingModifiers ("Lighting Modifiers", Float) = 0
+ [Enum(Poi Custom, 0, Correct, 1)] _LightingDirectColorMode ("Direct Light Color", Int) = 0
+ [ToggleUI]_LightingIndirectColorMode ("Indirect Uses Normals", Float) = 0
+ [ToggleUI]_LightingUncapped ("Uncapped Lighting", Float) = 0
+ [ToggleUI]_LightingOnlyUnityShadows ("Only Unity Shadows", Float) = 0
+ _LightingMonochromatic ("Monochromatic Lighting?", Range(0,1)) = 0
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingMinShadowBrightnessRatio ("Shadow:Light min Ratio", Range(0, 1)) = 0
+ [HideInInspector] m_end_lightingModifiers ("Lighting Modifiers", Float) = 0
+
+ [HideInInspector] m_start_detailShadows ("Detail Shadows--{reference_property:_LightingDetailShadowsEnabled, condition_show:{type:PROPERTY_BOOL,data:_LightingMode!=4}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingDetailShadowsEnabled ("Enabled Detail Shadows?", Float) = 0
+ _LightingDetailShadows ("Detail Shadows--{reference_properties:[_LightingDetailShadowsPan, _LightingDetailShadowsUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingDetailShadowsUV ("UV", Int) = 0
+ _LightingDetailStrength ("Detail Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_detailShadows ("Detail Shadows", Float) = 0
+
+ [HideInInspector] m_start_ambientOcclusion ("Ambient Occlusion--{reference_property:_LightingEnableAO}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingEnableAO ("Enable AO", Float) = 0
+ _LightingAOTex ("AO Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingAOTexUV ("UV", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_ambientOcclusion ("Ambient Occlusion", Float) = 0
+
+ // HSL Lighting
+ [HideInInspector] m_start_lightingHSL ("HSL Lighting--{reference_property:_LightingEnableHSL, condition_show:{type:PROPERTY_BOOL,data:_LightingMode==0}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingEnableHSL ("Enabled HSL Lighting", Float) = 0
+ _LightingHSLIntensity ("Shadow HSL Intensity", Range(0, 1)) = 1
+ _LightingShadowHue ("Shadow Hue Change", Range(0, 1)) = 0.5
+ _LightingShadowSaturation ("Shadow Saturation Change", Range(0, 1)) = 0.5
+ _LightingShadowLightness ("Shadow Lightness Change", Range(0, 1)) = 0.5
+ [HideInInspector] m_end_lightingHSL ("HSL Lighting", Float) = 0
+
+ // point/spot Light Settings
+ [HideInInspector] m_start_lightingAdvanced ("Additive Lighting (Point/Spot)--{reference_property:_LightingAdditiveEnable,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=at3p5yRRVU0&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw&index=12},hover:YouTube}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [Enum(Realistic, 0, Toon, 1, Wrapped, 2)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End", Range(0, 1)) = .5
+ _LightingAdditivePassthrough ("Point Light Passthrough", Range(0, 1)) = .5
+ _LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1
+ [ToggleUI]_LightingAdditiveLimitIntensity ("Limit Intensity", Float) = 0
+ _LightingAdditiveMaxIntensity ("Max Intensity--{condition_show:{type:PROPERTY_BOOL,data:_LightingAdditiveLimitIntensity==1}}", Range(0, 3)) = 1
+ [ThryToggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)]_DisableDirectionalInAdd ("No Directional", Float) = 1
+ [HideInInspector] m_end_lightingAdvanced ("Additive Lighting", Float) = 0
+ [HideInInspector] m_end_Lighting ("Light and Shadow", Float) = 0
+
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [ThryToggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSThicknessMap ("Thickness Map--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSSCale ("Light Strength", Range(0, 1)) = 0.25
+ _SSSPower ("Light Spread", Range(1, 100)) = 5
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+ /*
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [ThryToggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSStrength ("Strength", Float) = 4
+ _SSSConstant ("Constant", Range(0, .5)) = 0.1
+ _SSSNDotL ("NDotL Reduction", Range(0, 1)) = 0
+ _SSSExponent ("Spot Exponent", Range(2, 100)) = 30
+ _SSSNormalOffset ("Scattering", Range(0, .3)) = 0.05
+ _SSSPointLightDirectionality ("Point Light Directionality", Range(0, 1)) = .7
+ _SSSThicknessMap ("Thickness Map--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ [HideInInspector]_SSSThickness ("Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+ */
+
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting", Float) = 0
+ [ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [Enum(vertex, 0, pixel, 1)] _RimLightNormal ("Normal Select", Int) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 1
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimMaskUV ("UV", Int) = 0
+
+ [HideInInspector] m_start_rimHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_RimHueShiftEnabled ("Enabled", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed", Float) = 0
+ _RimHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_rimHueShift ("Hue Shift", Float) = 0
+
+ // Rim Noise
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_RimWidthNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimWidthNoiseTextureUV ("UV", Int) = 0
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Environmental Rim Lighting
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [ThryToggle(_MAPPING_6_FRAMES_LAYOUT)]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+
+ // Baked Lighting
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ _SpecularLMOcclusion("Specular Occlusion", Range(0,1)) = 0
+ _SpecLMOcclusionAdjust("Spec Occlusion Sensitiviy", Range(0,1)) = 0.2
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ [Helpbox(3)] _LockTooltip ("ALWAYS LOCK IN BEFORE UPLOADING. || RIGHT CLICK A PROPERTY IF YOU WANT TO ANIMATE IT.", Int) = 0
+
+ // BRDF
+ [HideInInspector] m_start_brdf ("Metallics & Specular--{reference_property:_EnableBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_CLASSIC)]_EnableBRDF ("Enable", Float) = 0
+ _BRDFMetallicGlossMap ("Metallic Gloss Map--{reference_properties:[_BRDFMetallicGlossMapPan, _BRDFMetallicGlossMapUV, _BRDFInvertGlossiness, _BRDFMetallicGlossMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFMetallicGlossMapToolTip ("R = Metallic, G = Reflectance, A = Glossiness/Smoothness/Inverse Roughness", Int) = 0
+ [HideInInspector][ToggleUI]_BRDFInvertGlossiness ("Invert Glossiness", Float) = 0
+ [HideInInspector][Vector2]_BRDFMetallicGlossMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFMetallicGlossMapUV ("UV", Int) = 0
+ _BRDFSpecularMap ("Specular Tint/Mask--{reference_properties:[_BRDFSpecularMapPan, _BRDFSpecularMapUV, _BRDFSpecularMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFSpecularMapToolTip ("RGB = Color, A = Mask", Int) = 0
+ [HideInInspector][Vector2]_BRDFSpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFSpecularMapUV ("UV", Int) = 0
+ _BRDFMetallicMap ("Metallic Tint/Mask--{reference_properties:[_BRDFMetallicMapPan, _BRDFMetallicMapUV, _BRDFMetallicMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFMetallicMapToolTip ("RGB = Color, A = Mask", Int) = 0
+ [HideInInspector][Vector2]_BRDFMetallicMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFMetallicMapUV ("UV", Int) = 0
+ _BRDFMetallic ("Metallic", Range(0,1)) = 0
+ _BRDFGlossiness ("Glossiness", Range(0,1)) = 0
+ _BRDFReflectance ("Reflectance", Range(0,1)) = .5
+ _BRDFAnisotropy ("Anisotropy", Range(-1,1)) = 0
+ _BRDFMetallicSpecIgnoresBaseColor("Spec Ignores Base Color", Range(0,1)) = 0
+ [ToggleUI]_BRDFReflectionsEnabled ("Enable Reflections", Float) = 1
+ [ToggleUI]_BRDFSpecularEnabled ("Enable Specular", Float) = 1
+ _BRDFFallback ("Fallback Reflection", Cube) = "" { }
+ [ToggleUI]_BRDFForceFallback ("Force Fallback Reflection", Range(0, 1)) = 0
+ [HideInInspector] m_end_brdf ("Baked Lighting", Float) = 0
+
+ // Metallics
+ [HideInInspector] m_start_Metallic ("Metallicsa", Float) = 0
+ [ThryToggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicTintMap ("Tint Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicTintMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MetallicTintMapUV ("UV", Int) = 0
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MetallicMaskUV ("UV", Int) = 0
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SmoothnessMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SmoothnessMaskUV ("UV", Int) = 0
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_Metallic ("Metallics", Float) = 0
+
+ // Clearcoat
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [ThryToggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ //[Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ //_ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearcoatMap ("Clear Coat Map--{reference_properties:[_ClearcoatMapPan, _ClearcoatMapUV, _ClearcoatInvertSmoothness, _ClearcoatHelpBox]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _ClearcoatHelpBox ("R = Clear Coat Map, G = Specular Mask, B = Reflection Mask, A = Glossiness/Smoothness/Inverse Roughness", Int) = 0
+ [HideInInspector][Vector2]_ClearcoatMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ClearcoatMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearcoatInvertSmoothness ("Invert Smoothness", Range(0, 1)) = 0
+ _Clearcoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearcoatGlossiness ("Smoothness", Range(0, 1)) = 0
+ _ClearcoatAnisotropy ("Anisotropy", Range(-1, 1)) = 0
+ [ToggleUI]_ClearcoatEnableReflections ("Enable Reflections", Range(0, 1)) = 1
+ [ToggleUI]_ClearcoatEnableSpecular ("Enable Specular", Range(0, 1)) = 1
+ _ClearcoatFallback ("Fallback CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearcoatForceFallback ("Force Fallback Cubemap", Range(0, 1)) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap / Sphere Textures", Float) = 0
+ [ThryToggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [HideInInspector] m_start_matcapHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_MatcapHueShiftEnabled ("Enabled", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed", Float) = 0
+ _MatcapHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_matcapHueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_matcap ("Matcap", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [HideInInspector] m_start_matcap2HueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_Matcap2HueShiftEnabled ("Enabled", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed", Float) = 0
+ _Matcap2HueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_matcap2HueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ // Specular
+ [HideInInspector] m_start_specular ("Specular Reflections", Float) = 0
+ [ThryToggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal ("Normal Select", Int) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic ("Metallic", Range(0, 1)) = 0
+ _SpecularMaxBrightness("Max Light Brightness", Float) = 0
+ [Gradient]_SpecularMetallicMap ("Metallic Map--{reference_properties:[_SpecularMetallicMapPan, _SpecularMetallicMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMetallicMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMetallicMapUV ("UV", Int) = 0
+ _SpecularSmoothness ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType==3}}}", Range(0, 1)) = 1
+ [Gradient]_SpecularMap ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMapUV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMaskUV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ // Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _Spec1Offset ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMapPan, _AnisoTangentMapUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _AnisoTangentMapUV ("UV", Int) = 0
+ //toon aniso
+ _SpecularToonStart ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicroPan, _SpecularAnisoJitterMicroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacroPan, _SpecularAnisoJitterMacroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMacroUV ("UV", Int) = 0
+ // Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular ("Specular Reflections", Float) = 0
+
+ // Second Specular
+ [HideInInspector] m_start_specular1 ("Specular Reflections 2", Float) = 0
+ [ThryToggle(DITHERING)]_EnableSpecular1 ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType1 ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal1 ("Normal Select", Int) = 1
+ _SpecularTint1 ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic1 ("Metallic", Range(0, 1)) = 0
+ _SpecularMaxBrightness1("Max Light Brightness", Float) = 0
+ [Gradient]_SpecularMetallicMap1 ("Metallic Map--{reference_properties:[_SpecularMetallicMapPan, _SpecularMetallicMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMetallicMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMetallicMap1UV ("UV", Int) = 0
+ _SpecularSmoothness1 ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==3}}}", Range(-2, 1)) = .75
+ _SpecularMap1 ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMap1UV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness1 ("Invert Smoothness", Float) = 0
+ _SpecularMask1 ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMask1UV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom1 ("Smoothness From", Int) = 1
+ // Second Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent1 ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Int) = 0
+ _AnisoSpec1Alpha1 ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha1 ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _Spec1Offset1 ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness1 ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap1 ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Float) = 0
+ _AnisoTangentMap1 ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMap1Pan, _AnisoTangentMap1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _AnisoTangentMap1UV ("UV", Int) = 0
+ // Second toon aniso
+ _SpecularToonStart1 ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd1 ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor1 ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored1 ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro1 ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicro1Pan, _SpecularAnisoJitterMicro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier1 ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMicro1UV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro1 ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacro1Pan, _SpecularAnisoJitterMacro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier1 ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMacro1UV ("UV", Int) = 0
+ // Second Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter1 ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular1 ("Specular Reflections", Float) = 0
+
+ // First Emission
+ [HideInInspector] m_Special_Effects ("Special Effects", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission / Glow", Float) = 0
+ [ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMapUV ("UV", Int) = 0
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMaskUV ("UV", Int) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed", Float) = 0
+
+ // Center out emission
+ [HideInInspector] m_start_CenterOutEmission ("Center Out Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionCenterOutEnabled ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission ("inward out emission", Float) = 0
+
+ // Glow in the dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [HideInInspector][ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionBlinkingEnabled ("Enable Blinking", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ // Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [HideInInspector][ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position", float) = 0
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ _EmissionScrollingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ // Emission Audio Link
+ [HideInInspector] m_start_EmissionAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [ToggleUI] _EnableEmissionStrengthAudioLink ("multiply Emission Strength", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionStrengthBand ("Emission Strength Band", Int) = 0
+ [ToggleUI] _EnableEmissionCenterOutAudioLink ("Center Out multipy", Float) = 0
+ _EmissionCenterOutAudioLinkWidth("C Out Mul Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionCenterOutBand ("Center Out M Band", Int) = 0
+ [Vector2] _EmissionCenterOutAddAudioLink ("Center Out Add", Vector) = (0,0,0,0)
+ _EmissionCenterOutAddAudioLinkwidth("C Out Add Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionCenterOutAddBand ("Center Out A Band", Int) = 0
+ [Vector2]_AudioLinkAddEmission ("Emission Strength Add", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkAddEmissionBand ("Emission Add Band", Int) = 0
+ [HideInInspector] m_end_EmissionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_emissionOptions ("Emission / Glow", Float) = 0
+
+ // Second Enission
+ [HideInInspector] m_start_emission1Options ("Emission / Glow 2 (Requires Emission 1 Enabled)", Float) = 0
+ [ThryToggle(EFFECT_HUE_VARIATION)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap1 ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMap1UV ("UV", Int) = 0
+ _EmissionMask1 ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMask1UV ("UV", Int) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled1 ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed", Float) = 0
+
+
+ // Second Center Out Enission
+ [HideInInspector] m_start_CenterOutEmission1 ("Center Out Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionCenterOutEnabled1 ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission1 ("inward out emission", Float) = 0
+
+ // Second Glow In The Dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [HideInInspector][ToggleUI]_EnableGITDEmission1 ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Second Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionBlinkingEnabled1 ("Enable Blinking", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+
+ // Scrolling Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions1 ("Scrolling Emission", Float) = 0
+ [HideInInspector][ToggleUI] _ScrollingEmission1 ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position", float) = 0
+ _EmissiveScroll_Direction1 ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval", Float) = 20
+ _EmissionScrollingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmission1Options ("Scrolling Emission", Float) = 0
+
+ // Emission Audio Link
+ [HideInInspector] m_start_Emission1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [ToggleUI] _EnableEmission1StrengthAudioLink ("Emission Strength", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1StrengthBand ("Emission Strength Band", Int) = 0
+ [ToggleUI] _EnableEmission1CenterOutAudioLink ("Center Out multipy", Float) = 0
+ _Emission1CenterOutAudioLinkWidth("C Out Mul Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band", Int) = 0
+ [Vector2] _EmissionCenterOutAddAudioLink1 ("Center Out Add", Vector) = (0,0,0,0)
+ _Emission1CenterOutAddAudioLinkwidth("C Out Add Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutAddBand ("Center Out A Band", Int) = 0
+ [Vector2]_AudioLinkAddEmission1 ("Emission Strength Add", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkAddEmission1Band ("Emission Add Band", Int) = 0
+ [HideInInspector] m_end_Emission1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_emission1Options ("Emission / Glow 2", Float) = 0
+
+ // Poiyomi Pathing
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(TONEMAPPING_CUSTOM)] _EnablePathing ("Enable Pathing", Float) = 0
+ _PathingMap ("RGB Path Map | A Mask--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _PathingColorMap ("RGB Color | A Mask--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _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
+ [HDR]_PathColorR ("R Color", Color) = (1, 1, 1)
+ [HDR]_PathColorG ("G Color", Color) = (1, 1, 1)
+ [HDR]_PathColorB ("B Color", Color) = (1, 1, 1)
+ [Vector3]_PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 1)
+ [Vector3]_PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ [Vector3]_PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1)
+ [Vector3]_PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 1)
+ [Header(Timing Options)]
+ [Vector3]_PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, 1)
+ [Vector3]_PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 1)
+ [Vector3]_PathSegments ("Path Segments", Vector) = (0.0, 0.0, 0.0, 1)
+ [HideInInspector] m_start_PathAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ // Time Offsets
+ [Header(Time Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B", Vector) = (0, 0, 0)
+
+ // Emission Offsets
+ [Header(Emission Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Emission R", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Emission G", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Emission B", Vector) = (0, 0, 0, 0)
+
+ // Length Offsets
+ [Header(Length Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_PathAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_pathing ("Pathing", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook", Float) = 0
+ [ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _FlipbookTexArrayUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _FlipbookMaskUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha("Alpha Mod", Vector) = (1,1,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission("Emission Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame("Frame control", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+
+ // Flipbook Manual Control
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+
+ [HideInInspector] m_start_crossfade ("Crossfade", Float) = 0
+ [ToggleUI]_FlipbookCrossfadeEnabled("Enable Crossfade?", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range", Vector) = (0.75, 1, 0, 1)
+ [HideInInspector] m_end_crossfade ("Crossfade", Float) = 0
+
+ [HideInInspector] m_start_flipbookHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_FlipbookHueShiftEnabled ("Enabled", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed", Float) = 0
+ _FlipbookHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_flipbookHueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve", Float) = 0
+ [ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolved Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_dissolveMasking ("Effect Masking", Float) = 0
+ [Enum(Undissolved, 0, Dissolved, 1, Both, 2)] _DissolveEmissionSide ("Emission 1", Int) = 2
+ [Enum(Undissolved, 0, Dissolved, 1, Both, 2)] _DissolveEmission1Side ("Emission 2", Int) = 2
+ [HideInInspector] m_end_dissolveMasking ("Effect Masking", Float) = 0
+
+ // Point to Point Dissolve
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1, Vertex Colors, 2)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0,1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+
+ [HideInInspector] m_start_dissolveAudioLink ("Audio Link ♫--{reference_property:_EnableDissolveAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDissolveAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_dissolveAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Panosphere
+ [HideInInspector] m_start_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [ThryToggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ [ToggleUI]_PanoInfiniteStereoToggle ("Infinite Stereo", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_PanoMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _PanoMaskUV ("UV", Int) = 0
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+ [HideInInspector] m_end_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle", Float) = 0
+ [ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [Enum(Angle, 0, Linear Emission, 1)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color", Color) = (1, 1, 1)
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0,0,0,0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(0, 1)) = .8
+ _GlitterHideInShadow("Hide in shadow", Range(0,1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [HideInInspector] m_start_glitterHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_GlitterHueShiftEnabled ("Enabled", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed", Float) = 0
+ _GlitterHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_glitterHueShift ("Hue Shift", Float) = 0
+
+ // Glitter Random Colors
+ [HideInInspector] m_start_glitterRandom ("Random Things", Float) = 0
+ [ToggleUI]_GlitterRandomColors ("Random Colors", Float) = 0
+ [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1)
+ [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1)
+ [ToggleUI]_GlitterRandomSize("Random Size?", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation("Random Tex Rotation", Float) = 0
+ [HideInInspector] m_end_glitterRandom ("Random Colors", Float) = 0
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("MSDF Text Overlay", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS", Float) = 0
+ [ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color", Color) = (1, 1, 1, 1)
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextFPS ("FPS", Float) = 0
+
+ // POSITION
+ [HideInInspector] m_start_TextPosition ("Position", Float) = 0
+ [ToggleUI]_TextPositionEnabled ("Position Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color", Color) = (1, 0, 1, 1)
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextPosition ("Position", Float) = 0
+
+ // INSTANCE TIME
+ [HideInInspector] m_start_TextInstanceTime ("Instance Time", Float) = 0
+ [ToggleUI]_TextTimeEnabled ("Time Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color", Color) = (1, 0, 1, 1)
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror", Float) = 0
+ [ThryToggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MirrorTextureUV ("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ // Distance Fade
+ [HideInInspector] m_start_distanceFade ("Distance Fade", Float) = 0
+ _MainFadeTexture ("Fade Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainFadeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainFadeTextureUV ("UV", Int) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _MainFadeType ("Pos To Use", Int) = 1
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainMaxAlpha ("Maximum Alpha", Range(0, 1)) = 1
+ _MainDistanceFadeMin ("Distance Min", Float) = 0
+ _MainDistanceFadeMax ("Distance Max", Float) = 0
+ [HideInInspector] m_end_distanceFade ("Distance Fade", Float) = 0
+
+ // Angular Fade
+ [HideInInspector] m_start_angularFade ("Angular Fade", Float) = 0
+ [ThryToggle(_SUNDISK_NONE)]_EnableRandom ("Enable Angular Fade", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_angularFade ("Angular Fade", Float) = 0
+
+ // UV Distortion
+ [HideInInspector] m_start_distortionFlow ("UV Distortion", Float) = 0
+ [ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1", 2D) = "black" { }
+ _DistortionFlowTexture1 ("Distortion Texture 2", 2D) = "black" { }
+ _DistortionStrength ("Strength1", Float) = 0.5
+ _DistortionStrength1 ("Strength2", Float) = 0.5
+ [Vector2]_DistortionSpeed ("Speed1", Vector) = (0.5, 0.5, 0, 0)
+ [Vector2]_DistortionSpeed1 ("Speed2", Vector) = (0.5, 0.5, 0, 0)
+
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_distortionFlow ("UV Distortion", Float) = 0
+
+ // Audio link
+ [HideInInspector] m_start_audioLink ("Audio Link--{reference_property:_EnableAudioLink}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_LOG_VIEW)] _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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ _AudioLinkDelay ("Delay", Range(0,1)) = 0
+ [ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ _AudioLinkAverageRange ("Average Sampling Range", Range(0,1)) = .5
+ // Debug
+ [HideInInspector] m_start_audioLinkDebug ("Debug--{reference_property:_EnableAudioLinkDebug}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableAudioLinkDebug("Enable?", Float) = 0
+ _AudioLinkDebugTreble ("Treble", Range(0,1)) = 0
+ _AudioLinkDebugHighMid ("High Mid", Range(0,1)) = 0
+ _AudioLinkDebugLowMid ("Low Mid", Range(0,1)) = 0
+ _AudioLinkDebugBass ("Bass", Range(0,1)) = 0
+ [ToggleUI] _AudioLinkDebugAnimate ("Debug Animate", Float) = 0
+ [ToggleUI]_AudioLinkTextureVisualization("Visualize Texture", Float) = 0
+ [HideInInspector] m_end_audioLinkDebug ("Debug", Float) = 0
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ // Start Patreon
+ [HideInInspector] m_Patreon ("Patreon", Float) = 0
+
+ // Video Options
+ [HideInInspector] m_start_Video ("Video--{reference_property:_EnableVideo}", Float) = 0
+ [ThryToggle(BLOOM)] _EnableVideo ("Enable Video", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _VideoUVNumber ("Screen UV#", Int) = 0
+ [Enum(LCD, 0, TN, 1, CRT, 2, OLED, 3, Gameboy, 4, Projector, 5)] _VideoType ("Screen Type", Int) = 3
+ _VideoBacklight ("Brightness", Range(0, 100)) = 1
+ [ToggleUI]_VideoEmissionEnabled ("Emission Enabled", Float) = 1
+ _VideoPixelTexture ("Pixel Texture", 2D) = "white" { }
+ [Vector2]_VideoResolution ("Resolution", Vector) = (1280, 720, 0)
+ _VideoMaskTexture ("Mask", 2D) = "white" { }
+ [Vector2]_VideoMaskPanning ("Mask Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_VideoSettings ("Video Texture Settings", Float) = 0
+ [ToggleUI]_VideoEnableVideoPlayer ("Enable Video Player", Float) = 0
+ [ToggleUI]_VideoPixelateToResolution ("Pixelate To Resolution", Float) = 0
+ [ToggleUI]_VideoRepeatVideoTexture ("Clamp To UV", Float) = 0
+ [Vector2]_VideoPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_VideoTiling ("Tiling", Vector) = (1, 1, 0, 0)
+ [Vector2]_VideoOffset ("Offset", Vector) = (0, 0, 0, 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_VideoDebug ("Video Debug", Float) = 0
+ [ToggleUI]_VideoEnableDebug ("Enable Debug", Float) = 0
+ _VideoDebugTexture ("Video Debug Tex", 2D) = "white" { }
+ [HideInInspector] m_end_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_start_CRT ("CRT Options", 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", Float) = 0
+ [Gradient]_VideoGameboyRamp ("Color Ramp", 2D) = "white" { }
+ [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Video ("Video", Float) = 0
+
+ // TouchFX
+ [HideInInspector] m_start_TouchOptions ("Touch FX", Float) = 0
+ [HideInInspector] m_start_Bulge ("Bulge--{reference_property:_EnableBulge}", Float) = 0
+ [ThryToggle(BLOOM_LOW)] _EnableBulge ("Bulge", Float) = 0
+ _BulgeMask ("Bulge Mask", 2D) = "white" { }
+ _BuldgeFadeLength ("Touch Distance", Float) = 0.02
+ _BuldgeHeight ("Bulge Height", Range(-0.2, 0.2)) = 0.02
+ [HideInInspector] m_end_Bulge ("Bulge", Float) = 0
+
+ [HideInInspector] m_start_TouchGlow ("Touch Color--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Touch Color", Float) = 0
+ [Enum(Depth, 0, UVs, 1)] _DepthGradientTextureUV ("UVs From", Int) = 0
+ [Enum(Replace, 0, Add, 1, Multiply, 2)] _DepthGradientBlend ("Color Blend", Int) = 0
+ _DepthGlowColor ("Depth Glow Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DepthGradient ("Depth Gradient--{reference_properties:[_DepthGradientPan, _DepthGradientUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthGradientPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DepthGradientUV ("UV", Int) = 0
+ _DepthMask ("Depth Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DepthMaskUV ("UV", Int) = 0
+ _DepthGlowEmission ("Depth Glow Emission", Float) = 3
+ _FadeLength ("Fade Length", Float) = 20
+ _DepthAlphaMin ("Alpha Min", Range(0, 1)) = 1
+ _DepthAlphaMax ("Alpha Max", Range(0, 1)) = 1
+ [HideInInspector] m_end_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchOptions ("Touch FX", Float) = 0
+
+ // Hologram
+ [HideInInspector] m_start_Hologram ("Hologram Alpha--{reference_property:_EnableHolo}", Float) = 0
+ [ThryToggle(DEPTH_OF_FIELD)]_EnableHolo ("Enable Hologram Alpha", Float) = 0
+ [Curve]_HoloAlphaMap ("Alpha Map", 2D) = "white" { }
+ [Enum(World Space, 0, Local Space, 1, UV, 2)]_HoloCoordinateSpace ("Coordinate Space", Int) = 0
+ _HoloDirection ("Scroll Direction", Vector) = (0, 1, 0)
+ _HoloLineDensity ("Line Density", Float) = 10
+ _HoloScrollSpeed ("Scroll Speed", Float) = 1
+ [HideInInspector] m_start_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ _HoloFresnelAlpha ("Intensity", Range(0, 1)) = 0
+ _HoloRimSharpness ("Sharpness", Range(0, 1)) = .5
+ _HoloRimWidth ("Width", Range(0, 1)) = .5
+ [HideInInspector] m_end_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_Hologram ("Hologram Alpha", Float) = 0
+
+ // Iridescence
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [ThryToggle(BLOOM_LENS_DIRT)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp", 2D) = "white" { }
+ _IridescencePanSpeed ("Pan", Float) = 0
+ _IridescenceOffset ("Offset", Float) = 0
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map", 2D) = "bump" { }
+ _IridescenceMask ("Mask", 2D) = "white" { }
+ _IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _IridescenceNormalUV ("Normal UV", Int) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _IridescenceMaskUV ("Mask UV", Int) = 0
+ [Enum(vertex, 0, pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Enum(Run Early, 0, Run Late, 1)] _IridescenceTime ("When To Run", Int) = 0
+ [Header(Hue Shift)]
+ [ToggleUI]_IridescenceHueShiftEnabled ("Hue Shift Enabled", Float) = 0
+ _IridescenceHueShiftSpeed ("Shift Speed", Float) = 0
+ _IridescenceHueShift ("Hue Shift", Range(0,1)) = 0
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionBand ("Scale Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmission("Scale Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // Vertex Glitching
+ [HideInInspector] m_start_VertexGlitch ("Vertex Glitching--{reference_property:_EnableVertexGlitch}", Float) = 0
+ [ToggleUI]_EnableVertexGlitch ("Enable Vertex Glitching", Float) = 0
+ _VertexGlitchFrequency ("Glitch Interval", Float) = 0
+ _VertexGlitchThreshold ("Glitch Threshold", Range(0, 1)) = 1
+ _VertexGlitchStrength ("Glitch Strength", Range(0, 10)) = 1
+ [HideInInspector] m_end_VertexGlitch ("Vertex Glitching", Float) = 0
+
+ // Spawn In Effects
+ [HideInInspector] m_start_Spawns ("Spawns", Float) = 0
+ [HideInInspector] m_start_ScifiSpawnIn ("Sci Fi--{reference_property:_EnableScifiSpawnIn}", Float) = 0
+ [HideInInspector][ToggleUI]_EnableScifiSpawnIn ("Enable Sci Fi Spawn", Float) = 0
+ _SpawnInNoise ("Spawn Noise", 2D) = "black" { }
+ _SpawnInNoiseIntensity ("Noise Intensity", Range(0, 1)) = .35
+ _SpawnInAlpha ("Spawn Alpha", Range(0, 1)) = 0
+ [Vector3]_SpawnInGradientStart ("Gradient Start", Vector) = (0, 2, 0)
+ [Vector3]_SpawnInGradientFinish ("Gradient End", Vector) = (0, -2, 0)
+ [HDR]_SpawnInEmissionColor ("Emission Color", Color) = (1, 1, 1)
+ _SpawnInEmissionOffset ("Emission Width", Range(0, 1)) = .1
+ _SpawnInVertOffset ("Vertex Offset Speed", Float) = 10
+ _SpawnInVertOffsetOffset ("vert width", Range(0, 1)) = .1
+ [HideInInspector] m_end_SciFiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_Spawns ("Spawns", Float) = 0
+
+ // Voronoi
+ [HideInInspector] m_start_Voronoi ("Voronoi--{reference_property:_EnableVoronoi}", Float) = 0
+ [Enum(2D(Fast), 0, 3D(Fast with color bugs), 1, 3D(slow but no bugs), 2)] _VoronoiType ("Type", Int) = 1
+ [Enum(Local, 0, World, 1, UV, 2)] _VoronoiSpace ("Space", Int) = 0
+ [Enum(Color and Emission, 0, Just Emission, 1)] _VoronoiBlend ("Blend", Int) = 0
+ [ThryToggle(CHROMATIC_ABERRATION)]_EnableVoronoi ("Enable Voronoi", Float) = 0
+ [ToggleUI]_VoronoiEffectsMaterialAlpha("Effects Material Alpha", Float) = 0
+ _VoronoiMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_VoronoiMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _VoronoiMaskUV ("UV", Int) = 0
+ _VoronoiNoise ("Edge Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_VoronoiNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _VoronoiNoiseUV ("UV", Int) = 0
+ _VoronoiNoiseIntensity ("Noise Intensity", Range(0, 1)) = .1
+ _VoronoiColor0 ("Color 0", Color) = (0, 0, 0, 1)
+ _VoronoiEmission0 ("Emission 0", Range(0, 20)) = 0
+ _VoronoiColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ _VoronoiEmission1 ("Emission 1", Range(0, 20)) = 0
+ [Vector2]_VoronoiGradient ("Gradient", Vector) = (.04, .05, 0, 0)
+ _VoronoiScale ("Scale", Float) = 5
+ [Vector3]_VoronoiSpeed ("Speed", Vector) = (3, 3, 3)
+ [HideInInspector] m_start_voronoiRandom ("Voronoi Random Cell Color--{reference_property:_VoronoiEnableRandomCellColor}", Float) = 0
+ [ToggleUI]_VoronoiEnableRandomCellColor ("Rando Cell Col", Float) = 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_end_Voronoi ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_BlackLight ("Black Light Mask--{reference_property:_BlackLightMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_SPECULARHIGHLIGHTS_OFF)]_BlackLightMaskEnabled ("Black Light Mask Enabled", Float) = 0
+ _BlackLightMaskKeys ("Mask Keys", Vector) = (2, 3, 4, 5)
+ _BlackLightMaskStart ("Gradient Start", Vector) = (0, 0, 0, 0)
+ _BlackLightMaskEnd ("Gradient End", Vector) = (1, 1, 1, 1)
+ [ToggleUI]_BlackLightMaskDebug ("Visualize", Float) = 0
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMetallic ("Metallic", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskClearCoat ("Clear Coat", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap ("Matcap 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap2 ("Matcap 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission ("Emission 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission2 ("Emission 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskFlipbook ("Flipbook", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskDissolve ("Dissolve", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskPanosphere ("Panosphere", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskGlitter ("Glitter", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskIridescence ("Iridescence", Int) = 4
+ [HideInInspector] m_end_BlackLight ("Black Light", Float) = 0
+ // End Patreon
+
+ // Outline Options
+ [HideInInspector] m_outlineOptions ("Outlines", Float) = 0
+ [ToggleUI]_commentIfZero_EnableOutlinePass ("Enable Outlines", float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ _OutlineTintMix ("Tint Mix--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==1}}", Range(0, 1)) = 0
+ _OutlineRimLightBlend ("Rim Light Blend--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==2}}", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==3}}", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==4}}", Vector) = (1, 0, 0, 0)
+ [ToggleUI]_OutlineFixedSize ("Fixed Size?", Float) = 0
+ _OutlinesMaxDistance ("Fixed Size Max Distance", Float) = 9999
+ [Enum(Off, 0, Normals, 1, Mask VC.r, 2)]_OutlineUseVertexColors ("Vertex Color", Float) = 0
+ [ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color", Color) = (1, 1, 1, 1)
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _OutlineTexture ("Outline Texture--{reference_properties:[_OutlineTexturePan, _OutlineTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineTexturePan ("Outline Texture Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _OutlineTextureUV ("UV", Int) = 0
+ _OutlineMask ("Outline Mask--{reference_properties:[_OutlineMaskPan, _OutlineMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _OutlineMaskUV ("UV", Int) = 0
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ [Header(Hue Shift)]
+ [ToggleUI]_OutlineHueShift ("Hue Shift?", Float) = 0
+ _OutlineHueOffset ("Shift", Range(0, 1)) = 0
+ _OutlineHueOffsetSpeed ("Shift Speed", Float) = 0
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ [Vector2]_OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ _OutlineOffsetFactor("Offset Factor", Float) = 0
+ _OutlineOffsetUnits("Offset Units", Float) = 0
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ // Parallax Mapping
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [ThryToggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ [Vector2]_ParallaxHeightMapPan ("Pan", Vector) = (0, 0, 0, 0)
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ParallaxUV ("Parallax UV", Int) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxHeightMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ParallaxHeightMapMaskUV ("UV", Int) = 0
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalMapMask ("Mask", 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
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+ [HideInInspector] m_start_parallaxAdvanced ("Advanced", Float) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_PostProcessing ("Post Processing", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section is designed for you to make adjustments to your final look in game through animations not to permentantly change settings before uploading.", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+
+ [HideInInspector] m_thirdparty ("Third Party", Float) = 0
+ // Raliv
+ [HideInInspector] m_start_raliv ("Raliv Dynamic Penetration System--{button_help:{text:Gumroad,action:{type:URL,data:https://gumroad.com/l/lwthuB},hover:Buy}}", Float) = 0
+ // Penetrator
+ [Helpbox(1)] _RalivHelp ("To use this you'll need to purchase the shader from the gumroad link in the header", Int) = 0
+ [HideInInspector] m_start_ralivPenetrator ("Penetrator--{reference_property:_PenetratorEnabled}", Float) = 0
+ [HideInInspector][ToggleUI] _PenetratorEnabled ("Enabled", Float) = 0
+ _squeeze("Squeeze Minimum Size", Range( 0 , 0.2)) = 0
+ _SqueezeDist("Squeeze Smoothness", Range( 0 , 0.1)) = 0
+ _BulgePower("Bulge Amount", Range( 0 , 0.01)) = 0
+ _BulgeOffset("Bulge Length", Range( 0 , 0.3)) = 0
+ _Length("Length of Penetrator Model", Range( 0 , 3)) = 0
+ _EntranceStiffness("Entrance Stiffness", Range( 0.01 , 1)) = 0.01
+ _Curvature("Curvature", Range( -1 , 1)) = 0
+ _ReCurvature("ReCurvature", Range( -1 , 1)) = 0
+ _Wriggle("Wriggle Amount", Range( 0 , 1)) = 0
+ _WriggleSpeed("Wriggle Speed", Range( 0.1 , 30)) = 0.28
+ [HideInInspector] __dirty( "", Int ) = 1
+ [HideInInspector] m_end_ralivPenetrator ("Penetrator", Float) = 0
+ // Oriface
+ [HideInInspector] m_start_ralivOriface ("Oriface--{reference_property:_OrifaceEnabled}", Float) = 0
+ [HideInInspector][ToggleUI] _OrifaceEnabled ("Enabled", Float) = 0
+ _OrificeData("OrificeData", 2D) = "white" {}
+ _EntryOpenDuration("Entry Trigger Duration", Range( 0 , 1)) = 0.1
+ _Shape1Depth("Shape 1 Trigger Depth", Range( 0 , 5)) = 0.1
+ _Shape1Duration("Shape 1 Trigger Duration", Range( 0 , 1)) = 0.1
+ _Shape2Depth("Shape 2 Trigger Depth", Range( 0 , 5)) = 0.2
+ _Shape2Duration("Shape 2 Trigger Duration", Range( 0 , 1)) = 0.1
+ _Shape3Depth("Shape 3 Trigger Depth", Range( 0 , 5)) = 0.3
+ _Shape3Duration("Shape 3 Trigger Duration", Range( 0 , 1)) = 0.1
+ _BlendshapePower("Blend Shape Power", Range(0,5)) = 1
+ _BlendshapeBadScaleFix("Blend Shape Bad Scale Fix", Range(1,100)) = 1
+ [HideInInspector] m_end_ralivOriface ("Oriface", Float) = 0
+ [HideInInspector] m_start_ralivAdvanced ("Advanced", Float) = 0
+ [Helpbox(1)] _RalivAdvancedHelp ("An advanced user feature that allows a separate channel for penetrators and orifices (think toy radio controlled cars) 0s only interact with 0s and 1s only interact with 1s", Int) = 0
+ _OrificeChannel("OrificeChannel Please Use 0", Float) = 0
+ [HideInInspector] m_end_ralivAdvanced ("Advanced", Float) = 0
+ [HideInInspector] m_end_raliv ("Raliv", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Outline Stencil
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil--{ condition_show:{type:PROPERTY_BOOL,data:_commentIfZero_EnableOutlinePass==1}}", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _OutlineStencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ // Debug Options
+ [HideInInspector] m_start_debugOptions ("Debug", Float) = 0
+ [HideInInspector][ThryToggle(_COLOROVERLAY_ON)]_DebugEnabled ("Display Debug Info", Float) = 0
+ _VertexUnwrap ("Unwrap", Range(0, 1)) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4, Local 0 Distance, 5)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ [HideInInspector] m_end_debugOptions ("Debug", Float) = 0
+ }
+
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry+10" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_BASE_PASS
+ float _Mode;
+ // Base Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // Pathing
+ #pragma shader_feature TONEMAPPING_CUSTOM
+ // patreon Base
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ //Audio Link
+ #pragma shader_feature COLOR_GRADING_LOG_VIEW
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Grab Pass Blur
+ #pragma shader_feature CHROMATIC_ABERRATION_LOW
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Touch Color
+ #pragma shader_feature GRAIN
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Emission 1
+ #pragma shader_feature _EMISSION
+ // Emission 2
+ #pragma shader_feature EFFECT_HUE_VARIATION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_ADD_PASS
+ float _Mode;
+ // Add Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+ // Pathing
+ #pragma shader_feature TONEMAPPING_CUSTOM
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ //Audio Link
+ #pragma shader_feature COLOR_GRADING_LOG_VIEW
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // Disable Directionals
+ #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
+ // Emission
+ #pragma shader_feature _EMISSION
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ //EnableOutlinePass
+ Pass
+ {
+ Name "Outline"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ ReadMask [_OutlineStencilReadMask]
+ WriteMask [_OutlineStencilWriteMask]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OutlineOffsetFactor], [_OutlineOffsetUnits]
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ AlphaToMask [_AlphaToMask]
+ Cull [_OutlineCull]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_BASE_PASS
+ #define OUTLINE
+ float _Mode;
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma multi_compile_instancing
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPassOutline.cginc"
+ ENDCG
+
+ }
+ //EnableOutlinePass
+
+ //LightingCastShadows
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ AlphaToMask Off
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define POI_SHADOW
+ float _Mode;
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/CGI_PoiPassShadow.cginc"
+ ENDCG
+
+ }
+ //LightingCastShadows
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+ Cull Off
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define POI_META_PASS
+ float _Mode;
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Emission 1
+ #pragma shader_feature _EMISSION
+ // Emission 2
+ #pragma shader_feature EFFECT_HUE_VARIATION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro.shader.meta
new file mode 100644
index 00000000..2339116d
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro.shader.meta
@@ -0,0 +1,111 @@
+fileFormatVersion: 2
+guid: e9e18fbf88ba9eb44ab0d683cd27c2a3
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {fileID: 2800000, guid: a6d6984545cde4a4f9317b17d6dca225, type: 3}
+ - _BumpMap: {instanceID: 0}
+ - _ClippingMask: {instanceID: 0}
+ - _MainColorAdjustTexture: {instanceID: 0}
+ - _RGBMask: {instanceID: 0}
+ - _RedTexure: {instanceID: 0}
+ - _GreenTexture: {instanceID: 0}
+ - _BlueTexture: {instanceID: 0}
+ - _RgbNormalR: {instanceID: 0}
+ - _RgbNormalG: {instanceID: 0}
+ - _RgbNormalB: {instanceID: 0}
+ - _DetailMask: {instanceID: 0}
+ - _DetailTex: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _VertexManipulationHeightMask: {instanceID: 0}
+ - _DecalTexture: {instanceID: 0}
+ - _DecalMask: {instanceID: 0}
+ - _BackFaceTexture: {instanceID: 0}
+ - _1st_ShadeMap: {instanceID: 0}
+ - _2nd_ShadeMap: {instanceID: 0}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ - _LightingShadowMask: {instanceID: 0}
+ - _LightingDetailShadows: {instanceID: 0}
+ - _LightingAOTex: {instanceID: 0}
+ - _SSSThicknessMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ - _RimMask: {instanceID: 0}
+ - _RimWidthNoiseTexture: {instanceID: 0}
+ - _RimEnviroMask: {instanceID: 0}
+ - _BRDFMetallicGlossMap: {instanceID: 0}
+ - _BRDFSpecularMap: {instanceID: 0}
+ - _BRDFMetallicMap: {instanceID: 0}
+ - _BRDFFallback: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ - _CubeMap: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ - _MetallicTintMap: {instanceID: 0}
+ - _MetallicMask: {instanceID: 0}
+ - _SmoothnessMask: {instanceID: 0}
+ - _ClearCoatCubeMap: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ - _ClearCoatMask: {instanceID: 0}
+ - _ClearCoatSmoothnessMap: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMask: {instanceID: 0}
+ - _Matcap2: {instanceID: 0}
+ - _Matcap2Mask: {instanceID: 0}
+ - _SpecularMetallicMap: {instanceID: 0}
+ - _SpecularMap: {instanceID: 0}
+ - _SpecularMask: {instanceID: 0}
+ - _AnisoTangentMap: {instanceID: 0}
+ - _SpecularAnisoJitterMicro: {instanceID: 0}
+ - _SpecularAnisoJitterMacro: {instanceID: 0}
+ - _SpecularMetallicMap1: {instanceID: 0}
+ - _SpecularMap1: {instanceID: 0}
+ - _SpecularMask1: {instanceID: 0}
+ - _AnisoTangentMap1: {instanceID: 0}
+ - _SpecularAnisoJitterMicro1: {instanceID: 0}
+ - _SpecularAnisoJitterMacro1: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _EmissionScrollingCurve: {instanceID: 0}
+ - _EmissionMap1: {instanceID: 0}
+ - _EmissionMask1: {instanceID: 0}
+ - _EmissionScrollingCurve1: {instanceID: 0}
+ - _FlipbookTexArray: {instanceID: 0}
+ - _FlipbookMask: {instanceID: 0}
+ - _DissolveEdgeGradient: {instanceID: 0}
+ - _DissolveToTexture: {instanceID: 0}
+ - _DissolveNoiseTexture: {instanceID: 0}
+ - _DissolveDetailNoise: {instanceID: 0}
+ - _DissolveMask: {instanceID: 0}
+ - _PanosphereTexture: {instanceID: 0}
+ - _PanoMask: {instanceID: 0}
+ - _PanoCubeMap: {instanceID: 0}
+ - _GlitterColorMap: {instanceID: 0}
+ - _GlitterMask: {instanceID: 0}
+ - _GlitterTexture: {instanceID: 0}
+ - _TextGlyphs: {instanceID: 0}
+ - _MirrorTexture: {instanceID: 0}
+ - _MainFadeTexture: {instanceID: 0}
+ - _DistortionMask: {instanceID: 0}
+ - _DistortionFlowTexture: {instanceID: 0}
+ - _DistortionFlowTexture1: {instanceID: 0}
+ - _VideoPixelTexture: {instanceID: 0}
+ - _VideoMaskTexture: {instanceID: 0}
+ - _VideoDebugTexture: {instanceID: 0}
+ - _VideoGameboyRamp: {instanceID: 0}
+ - _BulgeMask: {instanceID: 0}
+ - _DepthGradient: {instanceID: 0}
+ - _DepthMask: {instanceID: 0}
+ - _HoloAlphaMap: {instanceID: 0}
+ - _GrabPassBlendMap: {instanceID: 0}
+ - _IridescenceRamp: {instanceID: 0}
+ - _IridescenceNormalMap: {instanceID: 0}
+ - _IridescenceMask: {instanceID: 0}
+ - _SpawnInNoise: {instanceID: 0}
+ - _VoronoiMask: {instanceID: 0}
+ - _VoronoiNoise: {instanceID: 0}
+ - _OutlineTexture: {instanceID: 0}
+ - _OutlineMask: {instanceID: 0}
+ - _ParallaxHeightMap: {instanceID: 0}
+ - _ParallaxHeightMapMask: {instanceID: 0}
+ - _ParallaxInternalMap: {instanceID: 0}
+ - _ParallaxInternalMapMask: {instanceID: 0}
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro_GrabPass.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro_GrabPass.shader
new file mode 100644
index 00000000..3c734304
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro_GrabPass.shader
@@ -0,0 +1,2021 @@
+Shader ".poiyomi/Poiyomi 7.3/★ Pro Grabpass ★"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi Pro V7.3.050</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+ [HideInInspector] shader_properties_label_file ("7PlusLabels", Float) = 0
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, Multiplicative Grab Pass, 8)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZTest=4}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2460}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZTest=4}]},
+ {value:8,actions:[{type:SET_PROPERTY,data:render_queue=3010}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZTest=4}]}
+ }]}]}", Int) = 8
+
+ // Main
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _MainTex ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainTextureUV ("UV", Int) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ClippingMaskUV ("UV", Int) = 0
+ [ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+
+ //Hue Shifting
+ [HideInInspector] m_start_MainHueShift ("Color Adjust", Float) = 0
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?", Float) = 1
+ _MainHueShift ("Hue Shift", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed", Float) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness("Brightness", Range(-1,1)) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)]_MainHueShiftToggle ("Toggle Hueshift", Float) = 0
+ _MainColorAdjustTexture ("Mask R(H) G(S) B(B)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ _RGBMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBMaskPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color", Color) = (1, 1, 1, 1)
+ _RedTexure ("R Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBRedPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBRed_UV ("UV", int) = 0
+ _GreenColor ("G Color", Color) = (1, 1, 1, 1)
+ _GreenTexture ("G Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBGreenPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBGreen_UV ("UV", int) = 0
+ _BlueColor ("B Color", Color) = (1, 1, 1, 1)
+ _BlueTexture ("B Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBBluePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBBlue_UV ("UV", int) = 0
+ _AlphaColor ("A Color", Color) = (1, 1, 1, 1)
+ _AlphaTexture ("A Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBAlphaPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBAlpha_UV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalRPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalGPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalBPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalAPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Detail Options
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=9oIcQln9of4&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture Tint", Color) = (1, 1, 1)
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ // Vertex Colors
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ //Vertex Manipulations
+ [HideInInspector] m_start_vertexManipulation ("Vertex Offset--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Division Amount", Float) = 500
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ // Alpha Options
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ _Cutoff ("Alpha Cuttoff", Range(0, 1.001)) = 0.0
+ [ToggleUI]_DitheringEnabled ("Enable Dithering", Float) = 0
+ _DitherGradient ("Dither Gradient", Range(0, 1)) = .1
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 0
+ _MainShadowClipMod ("Shadow Clip Mod", Range(-1, 1)) = 0
+ [Enum(Off, 0, On, 1)] _AlphaToMask ("Alpha To Coverage", Float) = 0
+ [ToggleUI]_MainAlphaToCoverage ("Sharpenned A2C--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Float) = 0
+ _MainMipScale ("Mip Level Alpha Scale--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Range(0, 1)) = 0.25
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_DecalEnabled}", Float) = 0
+ _DecalMask ("Decal RGBA Mask--{reference_properties:[_DecalMaskPan, _DecalMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalMaskUV ("UV", Int) = 0
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ _DecalColor ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed", Float) = 0
+ _DecalHueShift ("Hue Shift", Range(0,1)) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ _DecalColor1 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled1 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed", Float) = 0
+ _DecalHueShift1 ("Hue Shift", Range(0,1)) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ _DecalColor2 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled2 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed", Float) = 0
+ _DecalHueShift2 ("Hue Shift", Range(0,1)) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ _DecalColor3 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled3 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed", Float) = 0
+ _DecalHueShift3 ("Hue Shift", Range(0,1)) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face", Float) = 0
+ [ToggleUI]_BackFaceEnabled ("Enable Back Face Options", Float) = 0
+ _BackFaceColor ("Color", Color) = (1, 1, 1, 1)
+ _BackFaceTexture ("Texture", 2D) = "white" { }
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ [HideInInspector][Vector2]_BackFacePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ _BackFaceHueShift ("Hue Shift", Range(0, 1)) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingOptions ("Lighting", Float) = 0
+ [HideInInspector] m_start_Lighting ("Light and Shadow", Float) = 0
+ [Toggle(VIGNETTE_MASKED)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Toon, 0, Realistic, 1, Wrapped (Beta), 2, Skin (Beta), 3, Flat, 4)] _LightingMode ("Lighting Type", Int) = 4
+ _LightingStandardSmoothness ("Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==1}}", Range(0, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}", Range(0, 1)) = 0
+ [Enum(Ramp Texture, 0, Math Gradient, 1, Shade Mapping, 2)] _LightingRampType ("Ramp Type--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}}}}", Int) = 0
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Color) = (1,1,1,1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", 2D) = "white" {}
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask("1st ShadeMap.a As ShadowMask", Float ) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse("1st ShadeMapMask Inverse", Float ) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}}", Float ) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Color) = (1,1,1,1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", 2D) = "white" {}
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask("2nd ShadeMap.a As ShadowMask", Float ) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse("2nd ShadeMapMask Inverse", Float ) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Float ) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.01, 1)) = 0
+ _1st2nd_Shades_Feather ("1st/2nd_Shades_Feather--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.0001, 1)) = 0.0001
+
+ // Ramp
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==0}}}", 2D) = "white" { }
+ _LightingShadowMask ("Ramp Mask--{reference_properties:[_LightingShadowMaskPan, _LightingShadowMaskUV],condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingShadowMaskUV ("UV", Int) = 0
+ _ShadowOffset ("Ramp Offset--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==0}}}}", Range(-1, 1)) = 0
+ //Math
+ _LightingGradientStart ("Gradient Start--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==1}}}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==1}}}", Range(0, 1)) = .5
+ // Skin
+ _SkinLUT ("LUT--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", 2D) = "white" {}
+ //_SssMaskCutoff ("Mask Cutoff--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0.01,1)) = 0.1
+ //_SssBias ("Bias--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 0
+ _SssScale ("Scale--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 0.7
+ [HideInInspector][Vector3]_SssTransmissionAbsorption ("Absorption--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Vector) = (-8,-40,-64,0)
+ [HideInInspector][Vector3]_SssColorBleedAoWeights ("AO Color Bleed--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Vector) = (0.4,0.15,0.13,0)
+ _LightingShadowColor ("Shadow Tint--{reference_property:_LightingDetailShadowsEnabled, condition_showS:(_LightingMode==0&&_LightingRampType!=2)||_LightingMode==2||_LightingMode==3}", Color) = (1, 1, 1, 1)
+ _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode==0&&_LightingRampType!=2)||_LightingMode==2}", Range(0, 1)) = 1
+ _AttenuationMultiplier ("Receive Casted Shadows--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode!=4}}", Range(0, 1)) = 0
+ [ToggleUI]_LightingIgnoreAmbientColor ("Ignore Ambient Color--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode!=4},condition2:{type:PROPERTY_BOOL,data:_LightingMode!=1}}}", Float) = 0
+
+ //_LightingShadowMap ("Shadow Color(RGB) and wrap(A)--{reference_properties:[_LightingShadowMapPan, _LightingShadowMapUV],condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}}", 2D) = "white" { }
+ //[HideInInspector][Vector2]_LightingShadowMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ //[HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingShadowMapUV ("UV", Int) = 0
+
+ [HideInInspector] m_start_lightingModifiers ("Lighting Modifiers", Float) = 0
+ [Enum(Poi Custom, 0, Correct, 1)] _LightingDirectColorMode ("Direct Light Color", Int) = 0
+ [ToggleUI]_LightingIndirectColorMode ("Indirect Uses Normals", Float) = 0
+ [ToggleUI]_LightingUncapped ("Uncapped Lighting", Float) = 0
+ [ToggleUI]_LightingOnlyUnityShadows ("Only Unity Shadows", Float) = 0
+ _LightingMonochromatic ("Monochromatic Lighting?", Range(0,1)) = 0
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingMinShadowBrightnessRatio ("Shadow:Light min Ratio", Range(0, 1)) = 0
+ [HideInInspector] m_end_lightingModifiers ("Lighting Modifiers", Float) = 0
+
+ [HideInInspector] m_start_detailShadows ("Detail Shadows--{reference_property:_LightingDetailShadowsEnabled, condition_show:{type:PROPERTY_BOOL,data:_LightingMode!=4}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingDetailShadowsEnabled ("Enabled Detail Shadows?", Float) = 0
+ _LightingDetailShadows ("Detail Shadows--{reference_properties:[_LightingDetailShadowsPan, _LightingDetailShadowsUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingDetailShadowsUV ("UV", Int) = 0
+ _LightingDetailStrength ("Detail Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_detailShadows ("Detail Shadows", Float) = 0
+
+ [HideInInspector] m_start_ambientOcclusion ("Ambient Occlusion--{reference_property:_LightingEnableAO}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingEnableAO ("Enable AO", Float) = 0
+ _LightingAOTex ("AO Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingAOTexUV ("UV", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_ambientOcclusion ("Ambient Occlusion", Float) = 0
+
+ // HSL Lighting
+ [HideInInspector] m_start_lightingHSL ("HSL Lighting--{reference_property:_LightingEnableHSL, condition_show:{type:PROPERTY_BOOL,data:_LightingMode==0}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingEnableHSL ("Enabled HSL Lighting", Float) = 0
+ _LightingHSLIntensity ("Shadow HSL Intensity", Range(0, 1)) = 1
+ _LightingShadowHue ("Shadow Hue Change", Range(0, 1)) = 0.5
+ _LightingShadowSaturation ("Shadow Saturation Change", Range(0, 1)) = 0.5
+ _LightingShadowLightness ("Shadow Lightness Change", Range(0, 1)) = 0.5
+ [HideInInspector] m_end_lightingHSL ("HSL Lighting", Float) = 0
+
+ // point/spot Light Settings
+ [HideInInspector] m_start_lightingAdvanced ("Additive Lighting (Point/Spot)--{reference_property_LightingAdditiveEnable,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=at3p5yRRVU0&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw&index=12},hover:YouTube}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [Enum(Realistic, 0, Toon, 1, Wrapped, 2)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End", Range(0, 1)) = .5
+ _LightingAdditivePassthrough ("Point Light Passthrough", Range(0, 1)) = .5
+ _LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1
+ [ToggleUI]_LightingAdditiveLimitIntensity ("Limit Intensity", Float) = 0
+ _LightingAdditiveMaxIntensity ("Max Intensity--{condition_show:{type:PROPERTY_BOOL,data:_LightingAdditiveLimitIntensity==1}}", Range(0, 3)) = 1
+ [ThryToggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)]_DisableDirectionalInAdd ("No Directional", Float) = 1
+ [HideInInspector] m_end_lightingAdvanced ("Additive Lighting", Float) = 0
+ [HideInInspector] m_end_Lighting ("Light and Shadow", Float) = 0
+
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [ThryToggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSThicknessMap ("Thickness Map--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSSCale ("Light Strength", Range(0, 1)) = 0.25
+ _SSSPower ("Light Spread", Range(1, 100)) = 5
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+ /*
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [ThryToggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSStrength ("Strength", Float) = 4
+ _SSSConstant ("Constant", Range(0, .5)) = 0.1
+ _SSSNDotL ("NDotL Reduction", Range(0, 1)) = 0
+ _SSSExponent ("Spot Exponent", Range(2, 100)) = 30
+ _SSSNormalOffset ("Scattering", Range(0, .3)) = 0.05
+ _SSSPointLightDirectionality ("Point Light Directionality", Range(0, 1)) = .7
+ _SSSThicknessMap ("Thickness Map--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ [HideInInspector]_SSSThickness ("Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+ */
+
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting", Float) = 0
+ [ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [Enum(vertex, 0, pixel, 1)] _RimLightNormal ("Normal Select", Int) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 1
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimMaskUV ("UV", Int) = 0
+
+ [HideInInspector] m_start_rimHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_RimHueShiftEnabled ("Enabled", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed", Float) = 0
+ _RimHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_rimHueShift ("Hue Shift", Float) = 0
+
+ // Rim Noise
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_RimWidthNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimWidthNoiseTextureUV ("UV", Int) = 0
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Environmental Rim Lighting
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [ThryToggle(_MAPPING_6_FRAMES_LAYOUT)]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+
+ // Baked Lighting
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ _SpecularLMOcclusion("Specular Occlusion", Range(0,1)) = 0
+ _SpecLMOcclusionAdjust("Spec Occlusion Sensitiviy", Range(0,1)) = 0.2
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ [Helpbox(3)] _LockTooltip ("ALWAYS LOCK IN BEFORE UPLOADING. || RIGHT CLICK A PROPERTY IF YOU WANT TO ANIMATE IT.", Int) = 0
+
+ // BRDF
+ [HideInInspector] m_start_brdf ("Metallics & Specular--{reference_property:_EnableBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_CLASSIC)]_EnableBRDF ("Enable", Float) = 0
+ _BRDFMetallicGlossMap ("Metallic Gloss Map--{reference_properties:[_BRDFMetallicGlossMapPan, _BRDFMetallicGlossMapUV, _BRDFInvertGlossiness, _BRDFMetallicGlossMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFMetallicGlossMapToolTip ("R = Metallic, G = Reflectance, A = Glossiness/Smoothness/Inverse Roughness", Int) = 0
+ [HideInInspector][ToggleUI]_BRDFInvertGlossiness ("Invert Glossiness", Float) = 0
+ [HideInInspector][Vector2]_BRDFMetallicGlossMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFMetallicGlossMapUV ("UV", Int) = 0
+ _BRDFSpecularMap ("Specular Tint/Mask--{reference_properties:[_BRDFSpecularMapPan, _BRDFSpecularMapUV, _BRDFSpecularMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFSpecularMapToolTip ("RGB = Color, A = Mask", Int) = 0
+ [HideInInspector][Vector2]_BRDFSpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFSpecularMapUV ("UV", Int) = 0
+ _BRDFMetallicMap ("Metallic Tint/Mask--{reference_properties:[_BRDFMetallicMapPan, _BRDFMetallicMapUV, _BRDFMetallicMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFMetallicMapToolTip ("RGB = Color, A = Mask", Int) = 0
+ [HideInInspector][Vector2]_BRDFMetallicMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFMetallicMapUV ("UV", Int) = 0
+ _BRDFMetallic ("Metallic", Range(0,1)) = 0
+ _BRDFGlossiness ("Glossiness", Range(0,1)) = 0
+ _BRDFReflectance ("Reflectance", Range(0,1)) = .5
+ _BRDFAnisotropy ("Anisotropy", Range(-1,1)) = 0
+ _BRDFMetallicSpecIgnoresBaseColor("Spec Ignores Base Color", Range(0,1)) = 0
+ [ToggleUI]_BRDFReflectionsEnabled ("Enable Reflections", Float) = 1
+ [ToggleUI]_BRDFSpecularEnabled ("Enable Specular", Float) = 1
+ _BRDFFallback ("Fallback Reflection", Cube) = "" { }
+ [ToggleUI]_BRDFForceFallback ("Force Fallback Reflection", Range(0, 1)) = 0
+ [HideInInspector] m_end_brdf ("Baked Lighting", Float) = 0
+
+ // Metallics
+ [HideInInspector] m_start_Metallic ("Metallicsa", Float) = 0
+ [ThryToggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicTintMap ("Tint Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicTintMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MetallicTintMapUV ("UV", Int) = 0
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MetallicMaskUV ("UV", Int) = 0
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SmoothnessMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SmoothnessMaskUV ("UV", Int) = 0
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_Metallic ("Metallics", Float) = 0
+
+ // Clearcoat
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [ThryToggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ //[Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ //_ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearcoatMap ("Clear Coat Map--{reference_properties:[_ClearcoatMapPan, _ClearcoatMapUV, _ClearcoatInvertSmoothness, _ClearcoatHelpBox]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _ClearcoatHelpBox ("R = Clear Coat Map, G = Specular Mask, B = Reflection Mask, A = Glossiness/Smoothness/Inverse Roughness", Int) = 0
+ [HideInInspector][Vector2]_ClearcoatMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ClearcoatMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearcoatInvertSmoothness ("Invert Smoothness", Range(0, 1)) = 0
+ _Clearcoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearcoatGlossiness ("Smoothness", Range(0, 1)) = 0
+ _ClearcoatAnisotropy ("Anisotropy", Range(-1, 1)) = 0
+ [ToggleUI]_ClearcoatEnableReflections ("Enable Reflections", Range(0, 1)) = 1
+ [ToggleUI]_ClearcoatEnableSpecular ("Enable Specular", Range(0, 1)) = 1
+ _ClearcoatFallback ("Fallback CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearcoatForceFallback ("Force Fallback Cubemap", Range(0, 1)) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap / Sphere Textures", Float) = 0
+ [ThryToggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [HideInInspector] m_start_matcapHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_MatcapHueShiftEnabled ("Enabled", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed", Float) = 0
+ _MatcapHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_matcapHueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_matcap ("Matcap", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [HideInInspector] m_start_matcap2HueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_Matcap2HueShiftEnabled ("Enabled", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed", Float) = 0
+ _Matcap2HueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_matcap2HueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ // Specular
+ [HideInInspector] m_start_specular ("Specular Reflections", Float) = 0
+ [ThryToggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal ("Normal Select", Int) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic ("Metallic", Range(0, 1)) = 0
+ _SpecularMaxBrightness("Max Light Brightness", Float) = 0
+ [Gradient]_SpecularMetallicMap ("Metallic Map--{reference_properties:[_SpecularMetallicMapPan, _SpecularMetallicMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMetallicMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMetallicMapUV ("UV", Int) = 0
+ _SpecularSmoothness ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType==3}}}", Range(0, 1)) = 1
+ [Gradient]_SpecularMap ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMapUV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMaskUV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ // Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _Spec1Offset ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMapPan, _AnisoTangentMapUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _AnisoTangentMapUV ("UV", Int) = 0
+ //toon aniso
+ _SpecularToonStart ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicroPan, _SpecularAnisoJitterMicroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacroPan, _SpecularAnisoJitterMacroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMacroUV ("UV", Int) = 0
+ // Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular ("Specular Reflections", Float) = 0
+
+ // Second Specular
+ [HideInInspector] m_start_specular1 ("Specular Reflections 2", Float) = 0
+ [ThryToggle(DITHERING)]_EnableSpecular1 ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType1 ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal1 ("Normal Select", Int) = 1
+ _SpecularTint1 ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic1 ("Metallic", Range(0, 1)) = 0
+ _SpecularMaxBrightness1("Max Light Brightness", Float) = 0
+ [Gradient]_SpecularMetallicMap1 ("Metallic Map--{reference_properties:[_SpecularMetallicMapPan, _SpecularMetallicMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMetallicMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMetallicMap1UV ("UV", Int) = 0
+ _SpecularSmoothness1 ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==3}}}", Range(-2, 1)) = .75
+ _SpecularMap1 ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMap1UV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness1 ("Invert Smoothness", Float) = 0
+ _SpecularMask1 ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMask1UV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom1 ("Smoothness From", Int) = 1
+ // Second Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent1 ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Int) = 0
+ _AnisoSpec1Alpha1 ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha1 ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _Spec1Offset1 ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness1 ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap1 ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Float) = 0
+ _AnisoTangentMap1 ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMap1Pan, _AnisoTangentMap1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _AnisoTangentMap1UV ("UV", Int) = 0
+ // Second toon aniso
+ _SpecularToonStart1 ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd1 ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor1 ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored1 ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro1 ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicro1Pan, _SpecularAnisoJitterMicro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier1 ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMicro1UV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro1 ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacro1Pan, _SpecularAnisoJitterMacro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier1 ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMacro1UV ("UV", Int) = 0
+ // Second Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter1 ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular1 ("Specular Reflections", Float) = 0
+
+ // First Emission
+ [HideInInspector] m_Special_Effects ("Special Effects", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission / Glow", Float) = 0
+ [ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMapUV ("UV", Int) = 0
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMaskUV ("UV", Int) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed", Float) = 0
+
+ // Center out emission
+ [HideInInspector] m_start_CenterOutEmission ("Center Out Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionCenterOutEnabled ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission ("inward out emission", Float) = 0
+
+ // Glow in the dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [HideInInspector][ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionBlinkingEnabled ("Enable Blinking", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ // Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [HideInInspector][ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position", float) = 0
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ _EmissionScrollingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ // Emission Audio Link
+ [HideInInspector] m_start_EmissionAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [ToggleUI] _EnableEmissionStrengthAudioLink ("multiply Emission Strength", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionStrengthBand ("Emission Strength Band", Int) = 0
+ [ToggleUI] _EnableEmissionCenterOutAudioLink ("Center Out multipy", Float) = 0
+ _EmissionCenterOutAudioLinkWidth("C Out Mul Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionCenterOutBand ("Center Out M Band", Int) = 0
+ [Vector2] _EmissionCenterOutAddAudioLink ("Center Out Add", Vector) = (0,0,0,0)
+ _EmissionCenterOutAddAudioLinkwidth("C Out Add Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionCenterOutAddBand ("Center Out A Band", Int) = 0
+ [Vector2]_AudioLinkAddEmission ("Emission Strength Add", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkAddEmissionBand ("Emission Add Band", Int) = 0
+ [HideInInspector] m_end_EmissionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_emissionOptions ("Emission / Glow", Float) = 0
+
+ // Second Enission
+ [HideInInspector] m_start_emission1Options ("Emission / Glow 2 (Requires Emission 1 Enabled)", Float) = 0
+ [ThryToggle(EFFECT_HUE_VARIATION)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap1 ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMap1UV ("UV", Int) = 0
+ _EmissionMask1 ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMask1UV ("UV", Int) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled1 ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed", Float) = 0
+
+
+ // Second Center Out Enission
+ [HideInInspector] m_start_CenterOutEmission1 ("Center Out Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionCenterOutEnabled1 ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission1 ("inward out emission", Float) = 0
+
+ // Second Glow In The Dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [HideInInspector][ToggleUI]_EnableGITDEmission1 ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Second Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionBlinkingEnabled1 ("Enable Blinking", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+
+ // Scrolling Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions1 ("Scrolling Emission", Float) = 0
+ [HideInInspector][ToggleUI] _ScrollingEmission1 ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position", float) = 0
+ _EmissiveScroll_Direction1 ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval", Float) = 20
+ _EmissionScrollingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmission1Options ("Scrolling Emission", Float) = 0
+
+ // Emission Audio Link
+ [HideInInspector] m_start_Emission1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [ToggleUI] _EnableEmission1StrengthAudioLink ("Emission Strength", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1StrengthBand ("Emission Strength Band", Int) = 0
+ [ToggleUI] _EnableEmission1CenterOutAudioLink ("Center Out multipy", Float) = 0
+ _Emission1CenterOutAudioLinkWidth("C Out Mul Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band", Int) = 0
+ [Vector2] _EmissionCenterOutAddAudioLink1 ("Center Out Add", Vector) = (0,0,0,0)
+ _Emission1CenterOutAddAudioLinkwidth("C Out Add Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutAddBand ("Center Out A Band", Int) = 0
+ [Vector2]_AudioLinkAddEmission1 ("Emission Strength Add", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkAddEmission1Band ("Emission Add Band", Int) = 0
+ [HideInInspector] m_end_Emission1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_emission1Options ("Emission / Glow 2", Float) = 0
+
+ // Poiyomi Pathing
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(TONEMAPPING_CUSTOM)] _EnablePathing ("Enable Pathing", Float) = 0
+ _PathingMap ("RGB Path Map | A Mask--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _PathingColorMap ("RGB Color | A Mask--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _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
+ [HDR]_PathColorR ("R Color", Color) = (1, 1, 1)
+ [HDR]_PathColorG ("G Color", Color) = (1, 1, 1)
+ [HDR]_PathColorB ("B Color", Color) = (1, 1, 1)
+ [Vector3]_PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 1)
+ [Vector3]_PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ [Vector3]_PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1)
+ [Vector3]_PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 1)
+ [Header(Timing Options)]
+ [Vector3]_PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, 1)
+ [Vector3]_PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 1)
+ [Vector3]_PathSegments ("Path Segments", Vector) = (0.0, 0.0, 0.0, 1)
+ [HideInInspector] m_start_PathAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ // Time Offsets
+ [Header(Time Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B", Vector) = (0, 0, 0)
+
+ // Emission Offsets
+ [Header(Emission Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Emission R", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Emission G", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Emission B", Vector) = (0, 0, 0, 0)
+
+ // Length Offsets
+ [Header(Length Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_PathAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_pathing ("Pathing", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook", Float) = 0
+ [ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _FlipbookTexArrayUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _FlipbookMaskUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha("Alpha Mod", Vector) = (1,1,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission("Emission Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame("Frame control", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+
+ // Flipbook Manual Control
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+
+ [HideInInspector] m_start_crossfade ("Crossfade", Float) = 0
+ [ToggleUI]_FlipbookCrossfadeEnabled("Enable Crossfade?", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range", Vector) = (0.75, 1, 0, 1)
+ [HideInInspector] m_end_crossfade ("Crossfade", Float) = 0
+
+ [HideInInspector] m_start_flipbookHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_FlipbookHueShiftEnabled ("Enabled", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed", Float) = 0
+ _FlipbookHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_flipbookHueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve", Float) = 0
+ [ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolved Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_dissolveMasking ("Effect Masking", Float) = 0
+ [Enum(Undissolved, 0, Dissolved, 1, Both, 2)] _DissolveEmissionSide ("Emission 1", Int) = 2
+ [Enum(Undissolved, 0, Dissolved, 1, Both, 2)] _DissolveEmission1Side ("Emission 2", Int) = 2
+ [HideInInspector] m_end_dissolveMasking ("Effect Masking", Float) = 0
+
+ // Point to Point Dissolve
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1, Vertex Colors, 2)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0,1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+
+ [HideInInspector] m_start_dissolveAudioLink ("Audio Link ♫--{reference_property:_EnableDissolveAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDissolveAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_dissolveAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Panosphere
+ [HideInInspector] m_start_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [ThryToggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ [ToggleUI]_PanoInfiniteStereoToggle ("Infinite Stereo", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_PanoMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _PanoMaskUV ("UV", Int) = 0
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+ [HideInInspector] m_end_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle", Float) = 0
+ [ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [Enum(Angle, 0, Linear Emission, 1)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color", Color) = (1, 1, 1)
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0,0,0,0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(0, 1)) = .8
+ _GlitterHideInShadow("Hide in shadow", Range(0,1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [HideInInspector] m_start_glitterHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_GlitterHueShiftEnabled ("Enabled", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed", Float) = 0
+ _GlitterHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_glitterHueShift ("Hue Shift", Float) = 0
+
+ // Glitter Random Colors
+ [HideInInspector] m_start_glitterRandom ("Random Things", Float) = 0
+ [ToggleUI]_GlitterRandomColors ("Random Colors", Float) = 0
+ [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1)
+ [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1)
+ [ToggleUI]_GlitterRandomSize("Random Size?", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation("Random Tex Rotation", Float) = 0
+ [HideInInspector] m_end_glitterRandom ("Random Colors", Float) = 0
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("MSDF Text Overlay", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS", Float) = 0
+ [ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color", Color) = (1, 1, 1, 1)
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextFPS ("FPS", Float) = 0
+
+ // POSITION
+ [HideInInspector] m_start_TextPosition ("Position", Float) = 0
+ [ToggleUI]_TextPositionEnabled ("Position Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color", Color) = (1, 0, 1, 1)
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextPosition ("Position", Float) = 0
+
+ // INSTANCE TIME
+ [HideInInspector] m_start_TextInstanceTime ("Instance Time", Float) = 0
+ [ToggleUI]_TextTimeEnabled ("Time Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color", Color) = (1, 0, 1, 1)
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror", Float) = 0
+ [ThryToggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MirrorTextureUV ("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ // Distance Fade
+ [HideInInspector] m_start_distanceFade ("Distance Fade", Float) = 0
+ _MainFadeTexture ("Fade Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainFadeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainFadeTextureUV ("UV", Int) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _MainFadeType ("Pos To Use", Int) = 1
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainMaxAlpha ("Maximum Alpha", Range(0, 1)) = 1
+ _MainDistanceFadeMin ("Distance Min", Float) = 0
+ _MainDistanceFadeMax ("Distance Max", Float) = 0
+ [HideInInspector] m_end_distanceFade ("Distance Fade", Float) = 0
+
+ // Angular Fade
+ [HideInInspector] m_start_angularFade ("Angular Fade", Float) = 0
+ [ThryToggle(_SUNDISK_NONE)]_EnableRandom ("Enable Angular Fade", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_angularFade ("Angular Fade", Float) = 0
+
+ // UV Distortion
+ [HideInInspector] m_start_distortionFlow ("UV Distortion", Float) = 0
+ [ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1", 2D) = "black" { }
+ _DistortionFlowTexture1 ("Distortion Texture 2", 2D) = "black" { }
+ _DistortionStrength ("Strength1", Float) = 0.5
+ _DistortionStrength1 ("Strength2", Float) = 0.5
+ [Vector2]_DistortionSpeed ("Speed1", Vector) = (0.5, 0.5, 0, 0)
+ [Vector2]_DistortionSpeed1 ("Speed2", Vector) = (0.5, 0.5, 0, 0)
+
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_distortionFlow ("UV Distortion", Float) = 0
+
+ // Audio link
+ [HideInInspector] m_start_audioLink ("Audio Link--{reference_property:_EnableAudioLink}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_LOG_VIEW)] _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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ _AudioLinkDelay ("Delay", Range(0,1)) = 0
+ [ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ _AudioLinkAverageRange ("Average Sampling Range", Range(0,1)) = .5
+ // Debug
+ [HideInInspector] m_start_audioLinkDebug ("Debug--{reference_property:_EnableAudioLinkDebug}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableAudioLinkDebug("Enable?", Float) = 0
+ _AudioLinkDebugTreble ("Treble", Range(0,1)) = 0
+ _AudioLinkDebugHighMid ("High Mid", Range(0,1)) = 0
+ _AudioLinkDebugLowMid ("Low Mid", Range(0,1)) = 0
+ _AudioLinkDebugBass ("Bass", Range(0,1)) = 0
+ [ToggleUI] _AudioLinkDebugAnimate ("Debug Animate", Float) = 0
+ [ToggleUI]_AudioLinkTextureVisualization("Visualize Texture", Float) = 0
+ [HideInInspector] m_end_audioLinkDebug ("Debug", Float) = 0
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ // Start Patreon
+ [HideInInspector] m_Patreon ("Patreon", Float) = 0
+
+ // Video Options
+ [HideInInspector] m_start_Video ("Video--{reference_property:_EnableVideo}", Float) = 0
+ [ThryToggle(BLOOM)] _EnableVideo ("Enable Video", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _VideoUVNumber ("Screen UV#", Int) = 0
+ [Enum(LCD, 0, TN, 1, CRT, 2, OLED, 3, Gameboy, 4, Projector, 5)] _VideoType ("Screen Type", Int) = 3
+ _VideoBacklight ("Brightness", Range(0, 100)) = 1
+ [ToggleUI]_VideoEmissionEnabled ("Emission Enabled", Float) = 1
+ _VideoPixelTexture ("Pixel Texture", 2D) = "white" { }
+ [Vector2]_VideoResolution ("Resolution", Vector) = (1280, 720, 0)
+ _VideoMaskTexture ("Mask", 2D) = "white" { }
+ [Vector2]_VideoMaskPanning ("Mask Pan Speed", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_start_VideoSettings ("Video Texture Settings", Float) = 0
+ [ToggleUI]_VideoEnableVideoPlayer ("Enable Video Player", Float) = 0
+ [ToggleUI]_VideoPixelateToResolution ("Pixelate To Resolution", Float) = 0
+ [ToggleUI]_VideoRepeatVideoTexture ("Clamp To UV", Float) = 0
+ [Vector2]_VideoPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_VideoTiling ("Tiling", Vector) = (1, 1, 0, 0)
+ [Vector2]_VideoOffset ("Offset", Vector) = (0, 0, 0, 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_VideoDebug ("Video Debug", Float) = 0
+ [ToggleUI]_VideoEnableDebug ("Enable Debug", Float) = 0
+ _VideoDebugTexture ("Video Debug Tex", 2D) = "white" { }
+ [HideInInspector] m_end_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_start_CRT ("CRT Options", 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", Float) = 0
+ [Gradient]_VideoGameboyRamp ("Color Ramp", 2D) = "white" { }
+ [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Video ("Video", Float) = 0
+
+ // TouchFX
+ [HideInInspector] m_start_TouchOptions ("Touch FX", Float) = 0
+ [HideInInspector] m_start_Bulge ("Bulge--{reference_property:_EnableBulge}", Float) = 0
+ [ThryToggle(BLOOM_LOW)] _EnableBulge ("Bulge", Float) = 0
+ _BulgeMask ("Bulge Mask", 2D) = "white" { }
+ _BuldgeFadeLength ("Touch Distance", Float) = 0.02
+ _BuldgeHeight ("Bulge Height", Range(-0.2, 0.2)) = 0.02
+ [HideInInspector] m_end_Bulge ("Bulge", Float) = 0
+
+ [HideInInspector] m_start_TouchGlow ("Touch Color--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Touch Color", Float) = 0
+ [Enum(Depth, 0, UVs, 1)] _DepthGradientTextureUV ("UVs From", Int) = 0
+ [Enum(Replace, 0, Add, 1, Multiply, 2)] _DepthGradientBlend ("Color Blend", Int) = 0
+ _DepthGlowColor ("Depth Glow Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DepthGradient ("Depth Gradient--{reference_properties:[_DepthGradientPan, _DepthGradientUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthGradientPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DepthGradientUV ("UV", Int) = 0
+ _DepthMask ("Depth Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DepthMaskUV ("UV", Int) = 0
+ _DepthGlowEmission ("Depth Glow Emission", Float) = 3
+ _FadeLength ("Fade Length", Float) = 20
+ _DepthAlphaMin ("Alpha Min", Range(0, 1)) = 1
+ _DepthAlphaMax ("Alpha Max", Range(0, 1)) = 1
+ [HideInInspector] m_end_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchOptions ("Touch FX", Float) = 0
+
+ // Hologram
+ [HideInInspector] m_start_Hologram ("Hologram Alpha--{reference_property:_EnableHolo}", Float) = 0
+ [ThryToggle(DEPTH_OF_FIELD)]_EnableHolo ("Enable Hologram Alpha", Float) = 0
+ [Curve]_HoloAlphaMap ("Alpha Map", 2D) = "white" { }
+ [Enum(World Space, 0, Local Space, 1, UV, 2)]_HoloCoordinateSpace ("Coordinate Space", Int) = 0
+ _HoloDirection ("Scroll Direction", Vector) = (0, 1, 0)
+ _HoloLineDensity ("Line Density", Float) = 10
+ _HoloScrollSpeed ("Scroll Speed", Float) = 1
+ [HideInInspector] m_start_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ _HoloFresnelAlpha ("Intensity", Range(0, 1)) = 0
+ _HoloRimSharpness ("Sharpness", Range(0, 1)) = .5
+ _HoloRimWidth ("Width", Range(0, 1)) = .5
+ [HideInInspector] m_end_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_Hologram ("Hologram Alpha", Float) = 0
+
+ // GrabPass
+ [HideInInspector] m_start_GrabPass ("GrabPass Transparency--{reference_property:_commentIfZero_EnableGrabpass}", Float) = 0
+ [ToggleUI] _commentIfZero_EnableGrabpass ("Enable GrabPass", Float) = 1
+ [ToggleUI]_GrabPassUseAlpha ("Use Alpha", Float) = 1
+ _GrabPassBlendMap ("Blend Map--{reference_properties:[_GrabPassBlendMapPan, _GrabPassBlendMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GrabPassBlendMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GrabPassBlendMapUV ("UV", Int) = 0
+ _GrabPassBlendFactor ("Blend Amount", Range(0,1)) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _GrabSrcBlend ("Source Blend", Int) = 2
+ [Enum(UnityEngine.Rendering.BlendMode)] _GrabDstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_start_Refraction ("Refraction--{reference_property:_RefractionEnabled}", Float) = 0
+ [ToggleUI] _RefractionEnabled ("Enable Refraction,", Float) = 0
+ _RefractionIndex ("Refraction", Range(0, 3)) = 1.333333
+ _RefractionChromaticAberattion ("Chromatic Aberration", Range(0, 1)) = 0
+ [HideInInspector] m_end_Refraction ("Refraction", Float) = 0
+ [HideInInspector] m_start_Blur ("Blur--{reference_property:_EnableBlur}", Float) = 0
+ [HideInInspector][ThryToggle(CHROMATIC_ABERRATION_LOW)]_EnableBlur ("Enable Blur", Float) = 0
+ _GrabBlurDistance ("Blur Distance", Range(0, 1)) = 0
+ [IntRange]_GrabBlurQuality ("Blur Quality", Range(1, 10)) = 2
+ [IntRange]_GrabBlurDirections ("Blur Directions", Range(1, 10)) = 4
+ [HideInInspector] m_end_Blur ("Blur", Float) = 0
+ [HideInInspector] m_end_GrabPass ("GrabPass Transparency", Float) = 0
+
+ // Iridescence
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [ThryToggle(BLOOM_LENS_DIRT)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp", 2D) = "white" { }
+ _IridescencePanSpeed ("Pan", Float) = 0
+ _IridescenceOffset ("Offset", Float) = 0
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map", 2D) = "bump" { }
+ _IridescenceMask ("Mask", 2D) = "white" { }
+ _IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _IridescenceNormalUV ("Normal UV", Int) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _IridescenceMaskUV ("Mask UV", Int) = 0
+ [Enum(vertex, 0, pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Enum(Run Early, 0, Run Late, 1)] _IridescenceTime ("When To Run", Int) = 0
+ [Header(Hue Shift)]
+ [ToggleUI]_IridescenceHueShiftEnabled ("Hue Shift Enabled", Float) = 0
+ _IridescenceHueShiftSpeed ("Shift Speed", Float) = 0
+ _IridescenceHueShift ("Hue Shift", Range(0,1)) = 0
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionBand ("Scale Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmission("Scale Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // Vertex Glitching
+ [HideInInspector] m_start_VertexGlitch ("Vertex Glitching--{reference_property:_EnableVertexGlitch}", Float) = 0
+ [ToggleUI]_EnableVertexGlitch ("Enable Vertex Glitching", Float) = 0
+ _VertexGlitchFrequency ("Glitch Interval", Float) = 0
+ _VertexGlitchThreshold ("Glitch Threshold", Range(0, 1)) = 1
+ _VertexGlitchStrength ("Glitch Strength", Range(0, 10)) = 1
+ [HideInInspector] m_end_VertexGlitch ("Vertex Glitching", Float) = 0
+
+ // Spawn In Effects
+ [HideInInspector] m_start_Spawns ("Spawns", Float) = 0
+ [HideInInspector] m_start_ScifiSpawnIn ("Sci Fi--{reference_property:_EnableScifiSpawnIn}", Float) = 0
+ [HideInInspector][ToggleUI]_EnableScifiSpawnIn ("Enable Sci Fi Spawn", Float) = 0
+ _SpawnInNoise ("Spawn Noise", 2D) = "black" { }
+ _SpawnInNoiseIntensity ("Noise Intensity", Range(0, 1)) = .35
+ _SpawnInAlpha ("Spawn Alpha", Range(0, 1)) = 0
+ [Vector3]_SpawnInGradientStart ("Gradient Start", Vector) = (0, 2, 0)
+ [Vector3]_SpawnInGradientFinish ("Gradient End", Vector) = (0, -2, 0)
+ [HDR]_SpawnInEmissionColor ("Emission Color", Color) = (1, 1, 1)
+ _SpawnInEmissionOffset ("Emission Width", Range(0, 1)) = .1
+ _SpawnInVertOffset ("Vertex Offset Speed", Float) = 10
+ _SpawnInVertOffsetOffset ("vert width", Range(0, 1)) = .1
+ [HideInInspector] m_end_SciFiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_Spawns ("Spawns", Float) = 0
+
+ // Voronoi
+ [HideInInspector] m_start_Voronoi ("Voronoi--{reference_property:_EnableVoronoi}", Float) = 0
+ [Enum(2D(Fast), 0, 3D(Fast with color bugs), 1, 3D(slow but no bugs), 2)] _VoronoiType ("Type", Int) = 1
+ [Enum(Local, 0, World, 1, UV, 2)] _VoronoiSpace ("Space", Int) = 0
+ [Enum(Color and Emission, 0, Just Emission, 1)] _VoronoiBlend ("Blend", Int) = 0
+ [ThryToggle(CHROMATIC_ABERRATION)]_EnableVoronoi ("Enable Voronoi", Float) = 0
+ [ToggleUI]_VoronoiEffectsMaterialAlpha("Effects Material Alpha", Float) = 0
+ _VoronoiMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_VoronoiMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _VoronoiMaskUV ("UV", Int) = 0
+ _VoronoiNoise ("Edge Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_VoronoiNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _VoronoiNoiseUV ("UV", Int) = 0
+ _VoronoiNoiseIntensity ("Noise Intensity", Range(0, 1)) = .1
+ _VoronoiColor0 ("Color 0", Color) = (0, 0, 0, 1)
+ _VoronoiEmission0 ("Emission 0", Range(0, 20)) = 0
+ _VoronoiColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ _VoronoiEmission1 ("Emission 1", Range(0, 20)) = 0
+ [Vector2]_VoronoiGradient ("Gradient", Vector) = (.04, .05, 0, 0)
+ _VoronoiScale ("Scale", Float) = 5
+ [Vector3]_VoronoiSpeed ("Speed", Vector) = (3, 3, 3)
+ [HideInInspector] m_start_voronoiRandom ("Voronoi Random Cell Color--{reference_property:_VoronoiEnableRandomCellColor}", Float) = 0
+ [ToggleUI]_VoronoiEnableRandomCellColor ("Rando Cell Col", Float) = 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_end_Voronoi ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_BlackLight ("Black Light Mask--{reference_property:_BlackLightMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_SPECULARHIGHLIGHTS_OFF)]_BlackLightMaskEnabled ("Black Light Mask Enabled", Float) = 0
+ _BlackLightMaskKeys ("Mask Keys", Vector) = (2, 3, 4, 5)
+ _BlackLightMaskStart ("Gradient Start", Vector) = (0, 0, 0, 0)
+ _BlackLightMaskEnd ("Gradient End", Vector) = (1, 1, 1, 1)
+ [ToggleUI]_BlackLightMaskDebug ("Visualize", Float) = 0
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMetallic ("Metallic", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskClearCoat ("Clear Coat", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap ("Matcap 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskMatcap2 ("Matcap 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission ("Emission 1", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskEmission2 ("Emission 2", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskFlipbook ("Flipbook", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskDissolve ("Dissolve", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskPanosphere ("Panosphere", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskGlitter ("Glitter", Int) = 4
+ [Enum(X, 0, Y, 1, Z, 2, W, 3, Off, 4)] _BlackLightMaskIridescence ("Iridescence", Int) = 4
+ [HideInInspector] m_end_BlackLight ("Black Light", Float) = 0
+ // End Patreon
+
+ // Outline Options
+ [HideInInspector] m_outlineOptions ("Outlines", Float) = 0
+ [ToggleUI]_commentIfZero_EnableOutlinePass ("Enable Outlines", float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ _OutlineTintMix ("Tint Mix--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==1}}", Range(0, 1)) = 0
+ _OutlineRimLightBlend ("Rim Light Blend--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==2}}", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==3}}", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==4}}", Vector) = (1, 0, 0, 0)
+ [ToggleUI]_OutlineFixedSize ("Fixed Size?", Float) = 0
+ _OutlinesMaxDistance ("Fixed Size Max Distance", Float) = 9999
+ [Enum(Off, 0, Normals, 1, Mask VC.r, 2)]_OutlineUseVertexColors ("Vertex Color", Float) = 0
+ [ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color", Color) = (1, 1, 1, 1)
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _OutlineTexture ("Outline Texture--{reference_properties:[_OutlineTexturePan, _OutlineTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineTexturePan ("Outline Texture Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _OutlineTextureUV ("UV", Int) = 0
+ _OutlineMask ("Outline Mask--{reference_properties:[_OutlineMaskPan, _OutlineMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _OutlineMaskUV ("UV", Int) = 0
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ [Header(Hue Shift)]
+ [ToggleUI]_OutlineHueShift ("Hue Shift?", Float) = 0
+ _OutlineHueOffset ("Shift", Range(0, 1)) = 0
+ _OutlineHueOffsetSpeed ("Shift Speed", Float) = 0
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ [Vector2]_OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ _OutlineOffsetFactor("Offset Factor", Float) = 0
+ _OutlineOffsetUnits("Offset Units", Float) = 0
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ // Parallax Mapping
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [ThryToggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ [Vector2]_ParallaxHeightMapPan ("Pan", Vector) = (0, 0, 0, 0)
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ParallaxUV ("Parallax UV", Int) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxHeightMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ParallaxHeightMapMaskUV ("UV", Int) = 0
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalMapMask ("Mask", 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
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+ [HideInInspector] m_start_parallaxAdvanced ("Advanced", Float) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_PostProcessing ("Post Processing", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section is designed for you to make adjustments to your final look in game through animations not to permentantly change settings before uploading.", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+
+ [HideInInspector] m_thirdparty ("Third Party", Float) = 0
+ // Raliv
+ [HideInInspector] m_start_raliv ("Raliv Dynamic Penetration System--{button_help:{text:Gumroad,action:{type:URL,data:https://gumroad.com/l/lwthuB},hover:Buy}}", Float) = 0
+ // Penetrator
+ [Helpbox(1)] _RalivHelp ("To use this you'll need to purchase the shader from the gumroad link in the header", Int) = 0
+ [HideInInspector] m_start_ralivPenetrator ("Penetrator--{reference_property:_PenetratorEnabled}", Float) = 0
+ [HideInInspector][ToggleUI] _PenetratorEnabled ("Enabled", Float) = 0
+ _squeeze("Squeeze Minimum Size", Range( 0 , 0.2)) = 0
+ _SqueezeDist("Squeeze Smoothness", Range( 0 , 0.1)) = 0
+ _BulgePower("Bulge Amount", Range( 0 , 0.01)) = 0
+ _BulgeOffset("Bulge Length", Range( 0 , 0.3)) = 0
+ _Length("Length of Penetrator Model", Range( 0 , 3)) = 0
+ _EntranceStiffness("Entrance Stiffness", Range( 0.01 , 1)) = 0.01
+ _Curvature("Curvature", Range( -1 , 1)) = 0
+ _ReCurvature("ReCurvature", Range( -1 , 1)) = 0
+ _Wriggle("Wriggle Amount", Range( 0 , 1)) = 0
+ _WriggleSpeed("Wriggle Speed", Range( 0.1 , 30)) = 0.28
+ [HideInInspector] __dirty( "", Int ) = 1
+ [HideInInspector] m_end_ralivPenetrator ("Penetrator", Float) = 0
+ // Oriface
+ [HideInInspector] m_start_ralivOriface ("Oriface--{reference_property:_OrifaceEnabled}", Float) = 0
+ [HideInInspector][ToggleUI] _OrifaceEnabled ("Enabled", Float) = 0
+ _OrificeData("OrificeData", 2D) = "white" {}
+ _EntryOpenDuration("Entry Trigger Duration", Range( 0 , 1)) = 0.1
+ _Shape1Depth("Shape 1 Trigger Depth", Range( 0 , 5)) = 0.1
+ _Shape1Duration("Shape 1 Trigger Duration", Range( 0 , 1)) = 0.1
+ _Shape2Depth("Shape 2 Trigger Depth", Range( 0 , 5)) = 0.2
+ _Shape2Duration("Shape 2 Trigger Duration", Range( 0 , 1)) = 0.1
+ _Shape3Depth("Shape 3 Trigger Depth", Range( 0 , 5)) = 0.3
+ _Shape3Duration("Shape 3 Trigger Duration", Range( 0 , 1)) = 0.1
+ _BlendshapePower("Blend Shape Power", Range(0,5)) = 1
+ _BlendshapeBadScaleFix("Blend Shape Bad Scale Fix", Range(1,100)) = 1
+ [HideInInspector] m_end_ralivOriface ("Oriface", Float) = 0
+ [HideInInspector] m_start_ralivAdvanced ("Advanced", Float) = 0
+ [Helpbox(1)] _RalivAdvancedHelp ("An advanced user feature that allows a separate channel for penetrators and orifices (think toy radio controlled cars) 0s only interact with 0s and 1s only interact with 1s", Int) = 0
+ _OrificeChannel("OrificeChannel Please Use 0", Float) = 0
+ [HideInInspector] m_end_ralivAdvanced ("Advanced", Float) = 0
+ [HideInInspector] m_end_raliv ("Raliv", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Outline Stencil
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil--{ condition_show:{type:PROPERTY_BOOL,data:_commentIfZero_EnableOutlinePass==1}}", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _OutlineStencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ // Debug Options
+ [HideInInspector] m_start_debugOptions ("Debug", Float) = 0
+ [HideInInspector][ThryToggle(_COLOROVERLAY_ON)]_DebugEnabled ("Display Debug Info", Float) = 0
+ _VertexUnwrap ("Unwrap", Range(0, 1)) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4, Local 0 Distance, 5)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ [HideInInspector] m_end_debugOptions ("Debug", Float) = 0
+ }
+
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "RenderType" = "Transparent" "Queue" = "Transparent+10" }
+ //EnableGrabpass
+ GrabPass
+ {
+ "_PoiGrab"
+ }
+ //EnableGrabpass
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_BASE_PASS
+ float _Mode;
+ // Base Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // Pathing
+ #pragma shader_feature TONEMAPPING_CUSTOM
+ // patreon Base
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ //Audio Link
+ #pragma shader_feature COLOR_GRADING_LOG_VIEW
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Grab Pass Blur
+ #pragma shader_feature CHROMATIC_ABERRATION_LOW
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Touch Color
+ #pragma shader_feature GRAIN
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Emission 1
+ #pragma shader_feature _EMISSION
+ // Emission 2
+ #pragma shader_feature EFFECT_HUE_VARIATION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_ADD_PASS
+ float _Mode;
+ // Add Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+ // Pathing
+ #pragma shader_feature TONEMAPPING_CUSTOM
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ //Audio Link
+ #pragma shader_feature COLOR_GRADING_LOG_VIEW
+ //Grab Pass Blur
+ #pragma shader_feature CHROMATIC_ABERRATION_LOW
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // Disable Directionals
+ #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
+ // Emission
+ #pragma shader_feature _EMISSION
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ //EnableOutlinePass
+ Pass
+ {
+ Name "Outline"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ ReadMask [_OutlineStencilReadMask]
+ WriteMask [_OutlineStencilWriteMask]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OutlineOffsetFactor], [_OutlineOffsetUnits]
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ AlphaToMask [_AlphaToMask]
+ Cull [_OutlineCull]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_BASE_PASS
+ #define OUTLINE
+ float _Mode;
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma multi_compile_instancing
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPassOutline.cginc"
+ ENDCG
+
+ }
+ //EnableOutlinePass
+
+ //LightingCastShadows
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ AlphaToMask Off
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define POI_SHADOW
+ float _Mode;
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/CGI_PoiPassShadow.cginc"
+ ENDCG
+
+ }
+ //LightingCastShadows
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+ Cull Off
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define POI_META_PASS
+ float _Mode;
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Emission 1
+ #pragma shader_feature _EMISSION
+ // Emission 2
+ #pragma shader_feature EFFECT_HUE_VARIATION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro_GrabPass.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro_GrabPass.shader.meta
new file mode 100644
index 00000000..b18d4ecb
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Pro_GrabPass.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8c9fa15670553cb43b993d5f5df2bf53
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Toon.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Toon.shader
new file mode 100644
index 00000000..6e4c04b1
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Toon.shader
@@ -0,0 +1,1838 @@
+Shader ".poiyomi/Poiyomi 7.3/• Poiyomi Toon •"
+{
+ Properties
+ {
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi Toon V7.3.050</color>", Float) = 0
+ [HideInInspector] shader_presets ("poiToonPresets", Float) = 0
+ [HideInInspector] shader_properties_label_file ("7PlusLabels", Float) = 0
+
+ [HideInInspector] footer_youtube ("youtube footer button", Float) = 0
+ [HideInInspector] footer_twitter ("twitter footer button", Float) = 0
+ [HideInInspector] footer_patreon ("patreon footer button", Float) = 0
+ [HideInInspector] footer_discord ("discord footer button", Float) = 0
+ [HideInInspector] footer_github ("github footer button", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7, Grab Pass (Pro Only), 8)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainOptions ("Main", Float) = 0
+ _Color ("Color & Alpha", Color) = (1, 1, 1, 1)
+ _MainTex ("Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainTextureUV ("UV", Int) = 0
+ _MainEmissionStrength ("Basic Emission", Range(0, 20)) = 0
+ [Normal]_BumpMap ("Normal Map", 2D) = "bump" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _BumpScale ("Normal Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ClippingMaskUV ("UV", Int) = 0
+ [ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+
+ //Hue Shifting
+ [HideInInspector] m_start_MainHueShift ("Color Adjust", Float) = 0
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?", Float) = 1
+ _MainHueShift ("Hue Shift", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed", Float) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness("Brightness", Range(-1,1)) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)]_MainHueShiftToggle ("Toggle Hueshift", Float) = 0
+ _MainColorAdjustTexture ("Mask R(H) G(S) B(B)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ _RGBMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBMaskPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color", Color) = (1, 1, 1, 1)
+ _RedTexure ("R Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBRedPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBRed_UV ("UV", int) = 0
+ _GreenColor ("G Color", Color) = (1, 1, 1, 1)
+ _GreenTexture ("G Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBGreenPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBGreen_UV ("UV", int) = 0
+ _BlueColor ("B Color", Color) = (1, 1, 1, 1)
+ _BlueTexture ("B Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBBluePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBBlue_UV ("UV", int) = 0
+ _AlphaColor ("A Color", Color) = (1, 1, 1, 1)
+ _AlphaTexture ("A Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RGBAlphaPanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RGBAlpha_UV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalRPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalGPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalBPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_RgbNormalAPan ("Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0,10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Detail Options
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=9oIcQln9of4&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ _DetailMask ("Detail Mask (R:Texture, G:Normal)", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture Tint", Color) = (1, 1, 1)
+ _DetailTex ("Detail Texture", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal", 2D) = "bump" { }
+ _DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ // Vertex Colors
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ //Vertex Manipulations
+ [HideInInspector] m_start_vertexManipulation ("Vertex Offset--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Division Amount", Float) = 500
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ // Alpha Options
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ _Cutoff ("Alpha Cuttoff", Range(0, 1.001)) = 0.5
+ [ToggleUI]_DitheringEnabled ("Enable Dithering", Float) = 0
+ _DitherGradient ("Dither Gradient", Range(0, 1)) = .1
+ [ToggleUI]_ForceOpaque ("Force Opaque", Float) = 0
+ _MainShadowClipMod ("Shadow Clip Mod", Range(-1, 1)) = 0
+ [Enum(Off, 0, On, 1)] _AlphaToMask ("Alpha To Coverage", Float) = 0
+ [ToggleUI]_MainAlphaToCoverage ("Sharpenned A2C--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Float) = 0
+ _MainMipScale ("Mip Level Alpha Scale--{condition_show:{type:PROPERTY_BOOL,data:_AlphaToMask==1}}", Range(0, 1)) = 0.25
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_DecalEnabled}", Float) = 0
+ _DecalMask ("Decal RGBA Mask--{reference_properties:[_DecalMaskPan, _DecalMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalMaskUV ("UV", Int) = 0
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ _DecalColor ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed", Float) = 0
+ _DecalHueShift ("Hue Shift", Range(0,1)) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ _DecalColor1 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled1 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed", Float) = 0
+ _DecalHueShift1 ("Hue Shift", Range(0,1)) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ _DecalColor2 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled2 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed", Float) = 0
+ _DecalHueShift2 ("Hue Shift", Range(0,1)) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ _DecalColor3 ("Color", Color) = (1, 1, 1, 1)
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DecalTexture3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge (Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3("Alpha", Range(0,1)) = 1
+ [ToggleUI]_DecalHueShiftEnabled3 ("Hue Shift Enabled", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed", Float) = 0
+ _DecalHueShift3 ("Hue Shift", Range(0,1)) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation("Rotation Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha("Alpha Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission("Emission Mod", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face", Float) = 0
+ [ToggleUI]_BackFaceEnabled ("Enable Back Face Options", Float) = 0
+ _BackFaceColor ("Color", Color) = (1, 1, 1, 1)
+ _BackFaceTexture ("Texture", 2D) = "white" { }
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ [HideInInspector][Vector2]_BackFacePanning ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ _BackFaceHueShift ("Hue Shift", Range(0, 1)) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingOptions ("Lighting", Float) = 0
+ [HideInInspector] m_start_Lighting ("Light and Shadow", Float) = 0
+ [Toggle(VIGNETTE_MASKED)]_EnableLighting ("Enable Lighting", Float) = 1
+ [Enum(Toon, 0, Realistic, 1, Wrapped (Beta), 2, Skin (Beta), 3, Flat, 4)] _LightingMode ("Lighting Type", Int) = 4
+ _LightingStandardSmoothness ("Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==1}}", Range(0, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}", Range(0, 1)) = 0
+ [Enum(Ramp Texture, 0, Math Gradient, 1, Shade Mapping, 2)] _LightingRampType ("Ramp Type--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}}}}", Int) = 0
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Color) = (1,1,1,1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", 2D) = "white" {}
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask("1st ShadeMap.a As ShadowMask", Float ) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse("1st ShadeMapMask Inverse", Float ) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}}", Float ) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Color) = (1,1,1,1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", 2D) = "white" {}
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask("2nd ShadeMap.a As ShadowMask", Float ) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse("2nd ShadeMapMask Inverse", Float ) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Float ) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.01, 1)) = 0
+ _1st2nd_Shades_Feather ("1st/2nd_Shades_Feather--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==2}}}", Range(0.0001, 1)) = 0.0001
+
+ // Ramp
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==0}}}", 2D) = "white" { }
+ _LightingShadowMask ("Ramp Mask--{reference_properties:[_LightingShadowMaskPan, _LightingShadowMaskUV],condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}}}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingShadowMaskUV ("UV", Int) = 0
+ _ShadowOffset ("Ramp Offset--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==0}}}}", Range(-1, 1)) = 0
+ //Math
+ _LightingGradientStart ("Gradient Start--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==1}}}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_show:{type:AND,condition1:{type:OR,condition1:{type:PROPERTY_BOOL,data:_LightingMode==0},condition2:{type:PROPERTY_BOOL,data:_LightingMode==2}},condition2:{type:PROPERTY_BOOL,data:_LightingRampType==1}}}", Range(0, 1)) = .5
+ // Skin
+ _SkinLUT ("LUT--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", 2D) = "white" {}
+ //_SssMaskCutoff ("Mask Cutoff--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0.01,1)) = 0.1
+ //_SssBias ("Bias--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 0
+ _SssScale ("Scale--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Range(0,1)) = 0.7
+ [HideInInspector][Vector3]_SssTransmissionAbsorption ("Absorption--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Vector) = (-8,-40,-64,0)
+ [HideInInspector][Vector3]_SssColorBleedAoWeights ("AO Color Bleed--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode==3}}", Vector) = (0.4,0.15,0.13,0)
+ _LightingShadowColor ("Shadow Tint--{reference_property:_LightingDetailShadowsEnabled, condition_showS:(_LightingMode==0&&_LightingRampType!=2)||_LightingMode==2||_LightingMode==3}", Color) = (1, 1, 1, 1)
+ _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode==0&&_LightingRampType!=2)||_LightingMode==2}", Range(0, 1)) = 1
+ _AttenuationMultiplier ("Receive Casted Shadows--{condition_show:{type:PROPERTY_BOOL,data:_LightingMode!=4}}", Range(0, 1)) = 0
+ [ToggleUI]_LightingIgnoreAmbientColor ("Ignore Ambient Color--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_LightingMode!=4},condition2:{type:PROPERTY_BOOL,data:_LightingMode!=1}}}", Float) = 0
+
+ //_LightingShadowMap ("Shadow Color(RGB) and wrap(A)--{reference_properties:[_LightingShadowMapPan, _LightingShadowMapUV],condition_show:{type:PROPERTY_BOOL,data:_LightingMode==2}}}", 2D) = "white" { }
+ //[HideInInspector][Vector2]_LightingShadowMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ //[HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingShadowMapUV ("UV", Int) = 0
+
+ [HideInInspector] m_start_lightingModifiers ("Lighting Modifiers", Float) = 0
+ [Enum(Poi Custom, 0, Correct, 1)] _LightingDirectColorMode ("Direct Light Color", Int) = 0
+ [ToggleUI]_LightingIndirectColorMode ("Indirect Uses Normals", Float) = 0
+ [ToggleUI]_LightingUncapped ("Uncapped Lighting", Float) = 0
+ [ToggleUI]_LightingOnlyUnityShadows ("Only Unity Shadows", Float) = 0
+ _LightingMonochromatic ("Monochromatic Lighting?", Range(0,1)) = 0
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingMinShadowBrightnessRatio ("Shadow:Light min Ratio", Range(0, 1)) = 0
+ [HideInInspector] m_end_lightingModifiers ("Lighting Modifiers", Float) = 0
+
+ [HideInInspector] m_start_detailShadows ("Detail Shadows--{reference_property:_LightingDetailShadowsEnabled, condition_show:{type:PROPERTY_BOOL,data:_LightingMode!=4}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingDetailShadowsEnabled ("Enabled Detail Shadows?", Float) = 0
+ _LightingDetailShadows ("Detail Shadows--{reference_properties:[_LightingDetailShadowsPan, _LightingDetailShadowsUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingDetailShadowsUV ("UV", Int) = 0
+ _LightingDetailStrength ("Detail Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_detailShadows ("Detail Shadows", Float) = 0
+
+ [HideInInspector] m_start_ambientOcclusion ("Ambient Occlusion--{reference_property:_LightingEnableAO}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingEnableAO ("Enable AO", Float) = 0
+ _LightingAOTex ("AO Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _LightingAOTexUV ("UV", Int) = 0
+ _AOStrength ("AO Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_ambientOcclusion ("Ambient Occlusion", Float) = 0
+
+ // HSL Lighting
+ [HideInInspector] m_start_lightingHSL ("HSL Lighting--{reference_property:_LightingEnableHSL, condition_show:{type:PROPERTY_BOOL,data:_LightingMode==0}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingEnableHSL ("Enabled HSL Lighting", Float) = 0
+ _LightingHSLIntensity ("Shadow HSL Intensity", Range(0, 1)) = 1
+ _LightingShadowHue ("Shadow Hue Change", Range(0, 1)) = 0.5
+ _LightingShadowSaturation ("Shadow Saturation Change", Range(0, 1)) = 0.5
+ _LightingShadowLightness ("Shadow Lightness Change", Range(0, 1)) = 0.5
+ [HideInInspector] m_end_lightingHSL ("HSL Lighting", Float) = 0
+
+ // point/spot Light Settings
+ [HideInInspector] m_start_lightingAdvanced ("Additive Lighting (Point/Spot)--{reference_property:_LightingAdditiveEnable,button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=at3p5yRRVU0&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw&index=12},hover:YouTube}}", Float) = 0
+ [HideInInspector][ToggleUI]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [Enum(Realistic, 0, Toon, 1, Wrapped, 2)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End", Range(0, 1)) = .5
+ _LightingAdditivePassthrough ("Point Light Passthrough", Range(0, 1)) = .5
+ _LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1
+ [ToggleUI]_LightingAdditiveLimitIntensity ("Limit Intensity", Float) = 0
+ _LightingAdditiveMaxIntensity ("Max Intensity--{condition_show:{type:PROPERTY_BOOL,data:_LightingAdditiveLimitIntensity==1}}", Range(0, 3)) = 1
+ [ThryToggle(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A)]_DisableDirectionalInAdd ("No Directional", Float) = 1
+ [HideInInspector] m_end_lightingAdvanced ("Additive Lighting", Float) = 0
+ [HideInInspector] m_end_Lighting ("Light and Shadow", Float) = 0
+
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [ThryToggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSThicknessMap ("Thickness Map--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ _SSSThicknessMod ("Thickness mod", Range(-1, 1)) = 0
+ _SSSSCale ("Light Strength", Range(0, 1)) = 0.25
+ _SSSPower ("Light Spread", Range(1, 100)) = 5
+ _SSSDistortion ("Light Distortion", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+ /*
+ // Subsurface Scattering
+ [HideInInspector] m_start_subsurface ("Subsurface Scattering", Float) = 0
+ [ThryToggle(_TERRAIN_NORMAL_MAP)]_EnableSSS ("Enable Subsurface Scattering", Float) = 0
+ _SSSColor ("Subsurface Color", Color) = (1, 0, 0, 1)
+ _SSSStrength ("Strength", Float) = 4
+ _SSSConstant ("Constant", Range(0, .5)) = 0.1
+ _SSSNDotL ("NDotL Reduction", Range(0, 1)) = 0
+ _SSSExponent ("Spot Exponent", Range(2, 100)) = 30
+ _SSSNormalOffset ("Scattering", Range(0, .3)) = 0.05
+ _SSSPointLightDirectionality ("Point Light Directionality", Range(0, 1)) = .7
+ _SSSThicknessMap ("Thickness Map--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_SSSThicknessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SSSThicknessMapUV ("UV", Int) = 0
+ [HideInInspector]_SSSThickness ("Strength", Range(0, 1)) = 1
+ [HideInInspector] m_end_subsurface ("Subsurface Scattering", Float) = 0
+ */
+
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting", Float) = 0
+ [ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [Enum(vertex, 0, pixel, 1)] _RimLightNormal ("Normal Select", Int) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting", Float) = 0
+ _RimLightColor ("Rim Color", Color) = (1, 1, 1, 1)
+ _RimWidth ("Rim Width", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness", Range(0, 1)) = .25
+ _RimStrength ("Rim Emission", Range(0, 20)) = 0
+ _RimBrighten ("Rim Color Brighten", Range(0, 3)) = 0
+ _RimLightColorBias ("Rim Color Bias", Range(0, 1)) = 1
+ _RimTex ("Rim Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimMaskUV ("UV", Int) = 0
+
+ [HideInInspector] m_start_rimHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_RimHueShiftEnabled ("Enabled", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed", Float) = 0
+ _RimHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_rimHueShift ("Hue Shift", Float) = 0
+
+ // Rim Noise
+ [HideInInspector] m_start_rimWidthNoise ("Width Noise", Float) = 0
+ _RimWidthNoiseTexture ("Rim Width Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_RimWidthNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimWidthNoiseTextureUV ("UV", Int) = 0
+ _RimWidthNoiseStrength ("Intensity", Range(0, 1)) = 0.1
+ [HideInInspector] m_end_rimWidthNoise ("Width Noise", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_ShadowMix ("Shadow Mix", Float) = 0
+ _ShadowMix ("Shadow Mix In", Range(0, 1)) = 0
+ _ShadowMixThreshold ("Shadow Mix Threshold", Range(0, 1)) = .5
+ _ShadowMixWidthMod ("Shadow Mix Width Mod", Range(0, 10)) = .5
+ [HideInInspector] m_end_ShadowMix ("Shadow Mix", Float) = 0
+
+ // Rim Shadow Mix
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Environmental Rim Lighting
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim", Float) = 0
+ [ThryToggle(_MAPPING_6_FRAMES_LAYOUT)]_EnableEnvironmentalRim ("Enable Environmental Rim", Float) = 0
+ _RimEnviroMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("Environmental Rim", Float) = 0
+
+ // Baked Lighting
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ _SpecularLMOcclusion("Specular Occlusion", Range(0,1)) = 0
+ _SpecLMOcclusionAdjust("Spec Occlusion Sensitiviy", Range(0,1)) = 0.2
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ [Helpbox(3)] _LockTooltip ("ALWAYS LOCK IN BEFORE UPLOADING. || RIGHT CLICK A PROPERTY IF YOU WANT TO ANIMATE IT.", Int) = 0
+
+ // BRDF
+ [HideInInspector] m_start_brdf ("Metallics & Specular--{reference_property:_EnableBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_CLASSIC)]_EnableBRDF ("Enable", Float) = 0
+ _BRDFMetallicGlossMap ("Metallic Gloss Map--{reference_properties:[_BRDFMetallicGlossMapPan, _BRDFMetallicGlossMapUV, _BRDFInvertGlossiness, _BRDFMetallicGlossMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFMetallicGlossMapToolTip ("R = Metallic, G = Reflectance, A = Glossiness/Smoothness/Inverse Roughness", Int) = 0
+ [HideInInspector][ToggleUI]_BRDFInvertGlossiness ("Invert Glossiness", Float) = 0
+ [HideInInspector][Vector2]_BRDFMetallicGlossMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFMetallicGlossMapUV ("UV", Int) = 0
+ _BRDFSpecularMap ("Specular Tint/Mask--{reference_properties:[_BRDFSpecularMapPan, _BRDFSpecularMapUV, _BRDFSpecularMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFSpecularMapToolTip ("RGB = Color, A = Mask", Int) = 0
+ [HideInInspector][Vector2]_BRDFSpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFSpecularMapUV ("UV", Int) = 0
+ _BRDFMetallicMap ("Metallic Tint/Mask--{reference_properties:[_BRDFMetallicMapPan, _BRDFMetallicMapUV, _BRDFMetallicMapToolTip]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _BRDFMetallicMapToolTip ("RGB = Color, A = Mask", Int) = 0
+ [HideInInspector][Vector2]_BRDFMetallicMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _BRDFMetallicMapUV ("UV", Int) = 0
+ _BRDFMetallic ("Metallic", Range(0,1)) = 0
+ _BRDFGlossiness ("Glossiness", Range(0,1)) = 0
+ _BRDFReflectance ("Reflectance", Range(0,1)) = .5
+ _BRDFAnisotropy ("Anisotropy", Range(-1,1)) = 0
+ _BRDFMetallicSpecIgnoresBaseColor("Spec Ignores Base Color", Range(0,1)) = 0
+ [ToggleUI]_BRDFReflectionsEnabled ("Enable Reflections", Float) = 1
+ [ToggleUI]_BRDFSpecularEnabled ("Enable Specular", Float) = 1
+ _BRDFFallback ("Fallback Reflection", Cube) = "" { }
+ [ToggleUI]_BRDFForceFallback ("Force Fallback Reflection", Range(0, 1)) = 0
+ [HideInInspector] m_end_brdf ("Baked Lighting", Float) = 0
+
+ // Metallics
+ [HideInInspector] m_start_Metallic ("Metallicsa", Float) = 0
+ [ThryToggle(_METALLICGLOSSMAP)]_EnableMetallic ("Enable Metallics", Float) = 0
+ _CubeMap ("Baked CubeMap", Cube) = "" { }
+ [ToggleUI]_SampleWorld ("Force Baked Cubemap", Range(0, 1)) = 0
+ _MetalReflectionTint ("Reflection Tint", Color) = (1, 1, 1)
+ _MetallicTintMap ("Tint Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicTintMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MetallicTintMapUV ("UV", Int) = 0
+ _MetallicMask ("Metallic Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MetallicMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MetallicMaskUV ("UV", Int) = 0
+ _Metallic ("Metallic", Range(0, 1)) = 0
+ _SmoothnessMask ("Smoothness Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SmoothnessMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SmoothnessMaskUV ("UV", Int) = 0
+ [ToggleUI]_InvertSmoothness ("Invert Smoothness Map", Range(0, 1)) = 0
+ _Smoothness ("Smoothness", Range(0, 1)) = 0
+ [HideInInspector] m_end_Metallic ("Metallics", Float) = 0
+
+ // Clearcoat
+ [HideInInspector] m_start_clearCoat ("Clear Coat", Float) = 0
+ [ThryToggle(_COLORCOLOR_ON)]_EnableClearCoat ("Enable Clear Coat", Float) = 0
+ //[Enum(Vertex, 0, Pixel, 1)] _ClearCoatNormalToUse ("What Normal?", Int) = 0
+ //_ClearCoatTint ("Reflection Tint", Color) = (1, 1, 1)
+ _ClearcoatMap ("Clear Coat Map--{reference_properties:[_ClearcoatMapPan, _ClearcoatMapUV, _ClearcoatInvertSmoothness, _ClearcoatHelpBox]}", 2D) = "white" { }
+ [HideInInspector][Helpbox(1)] _ClearcoatHelpBox ("R = Clear Coat Map, G = Specular Mask, B = Reflection Mask, A = Glossiness/Smoothness/Inverse Roughness", Int) = 0
+ [HideInInspector][Vector2]_ClearcoatMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ClearcoatMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearcoatInvertSmoothness ("Invert Smoothness", Range(0, 1)) = 0
+ _Clearcoat ("Clear Coat", Range(0, 1)) = 1
+ _ClearcoatGlossiness ("Smoothness", Range(0, 1)) = 0
+ _ClearcoatAnisotropy ("Anisotropy", Range(-1, 1)) = 0
+ [ToggleUI]_ClearcoatEnableReflections ("Enable Reflections", Range(0, 1)) = 1
+ [ToggleUI]_ClearcoatEnableSpecular ("Enable Specular", Range(0, 1)) = 1
+ _ClearcoatFallback ("Fallback CubeMap", Cube) = "" { }
+ [ToggleUI]_ClearcoatForceFallback ("Force Fallback Cubemap", Range(0, 1)) = 0
+ [HideInInspector] m_end_clearCoat ("Clear Coat", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap / Sphere Textures", Float) = 0
+ [ThryToggle(_COLORADDSUBDIFF_ON)]_MatcapEnable ("Enable Matcap", Float) = 0
+ _MatcapColor ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace With Matcap", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Matcap", Range(0, 1)) = 0
+ _MatcapAdd ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [HideInInspector] m_start_matcapHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_MatcapHueShiftEnabled ("Enabled", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed", Float) = 0
+ _MatcapHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_matcapHueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_matcap ("Matcap", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 2", Float) = 0
+ [ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ _Matcap2Color ("Color", Color) = (1, 1, 1, 1)
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace With Matcap", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Matcap", Range(0, 1)) = 0
+ _Matcap2Add ("Add Matcap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [HideInInspector] m_start_matcap2HueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_Matcap2HueShiftEnabled ("Enabled", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed", Float) = 0
+ _Matcap2HueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_matcap2HueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2", Float) = 0
+
+ // Specular
+ [HideInInspector] m_start_specular ("Specular Reflections", Float) = 0
+ [ThryToggle(_SPECGLOSSMAP)]_EnableSpecular ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal ("Normal Select", Int) = 1
+ _SpecularTint ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic ("Metallic", Range(0, 1)) = 0
+ _SpecularMaxBrightness("Max Light Brightness", Float) = 0
+ [Gradient]_SpecularMetallicMap ("Metallic Map--{reference_properties:[_SpecularMetallicMapPan, _SpecularMetallicMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMetallicMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMetallicMapUV ("UV", Int) = 0
+ _SpecularSmoothness ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType==3}}}", Range(0, 1)) = 1
+ [Gradient]_SpecularMap ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMapUV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness ("Invert Smoothness", Float) = 0
+ _SpecularMask ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMaskUV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom ("Smoothness From", Int) = 1
+ // Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Int) = 0
+ _AnisoSpec1Alpha ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 1
+ _Spec1Offset ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Float) = 0
+ _AnisoTangentMap ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMapPan, _AnisoTangentMapUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _AnisoTangentMapUV ("UV", Int) = 0
+ //toon aniso
+ _SpecularToonStart ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicroPan, _SpecularAnisoJitterMicroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMicroUV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacroPan, _SpecularAnisoJitterMacroUV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacroPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMacroUV ("UV", Int) = 0
+ // Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular ("Specular Reflections", Float) = 0
+
+ // Second Specular
+ [HideInInspector] m_start_specular1 ("Specular Reflections 2", Float) = 0
+ [ThryToggle(DITHERING)]_EnableSpecular1 ("Enable Specular", Float) = 0
+ [Enum(Realistic, 1, Toon, 2, Anisotropic, 3, Toon Aniso, 4)] _SpecularType1 ("Specular Type", Int) = 1
+ [Enum(vertex, 0, pixel, 1)] _SpecularNormal1 ("Normal Select", Int) = 1
+ _SpecularTint1 ("Specular Tint", Color) = (1, 1, 1, 1)
+ _SpecularMetallic1 ("Metallic", Range(0, 1)) = 0
+ _SpecularMaxBrightness1("Max Light Brightness", Float) = 0
+ [Gradient]_SpecularMetallicMap1 ("Metallic Map--{reference_properties:[_SpecularMetallicMapPan, _SpecularMetallicMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMetallicMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMetallicMap1UV ("UV", Int) = 0
+ _SpecularSmoothness1 ("Smoothness--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==1},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==3}}}", Range(-2, 1)) = .75
+ _SpecularMap1 ("Specular Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMap1UV ("UV", Int) = 0
+ [ToggleUI]_SpecularInvertSmoothness1 ("Invert Smoothness", Float) = 0
+ _SpecularMask1 ("Specular Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_SpecularMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularMask1UV ("UV", Int) = 0
+ [Enum(Alpha, 0, Grayscale, 1)] _SmoothnessFrom1 ("Smoothness From", Int) = 1
+ // Second Anisotropic Specular
+ [Enum(Tangent, 0, binormal, 1)] _SpecWhatTangent1 ("(Bi)Tangent?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Int) = 0
+ _AnisoSpec1Alpha1 ("Spec1 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _AnisoSpec2Alpha1 ("Spec2 Alpha--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 1
+ _Spec1Offset1 ("Spec1 Offset--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(-1, 1)) = 0
+ _Spec2Smoothness1 ("Spec2 Smoothness--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==3}}", Range(0, 1)) = 0
+ [ToggleUI]_AnisoUseTangentMap1 ("Use Directional Map?--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Float) = 0
+ _AnisoTangentMap1 ("Anisotropic Directional Map--{reference_properties:[_AnisoTangentMap1Pan, _AnisoTangentMap1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_AnisoTangentMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _AnisoTangentMap1UV ("UV", Int) = 0
+ // Second toon aniso
+ _SpecularToonStart1 ("Spec Toon Start--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 1)) = .95
+ _SpecularToonEnd1 ("Spec Toon End--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Range(0, 2)) = 1
+ //[ToggleUI]_CenterOutSpecColor1 ("Center Out SpecMap--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [ToggleUI]_SpecularAnisoJitterMirrored1 ("Mirrored?--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==4}}", Float) = 0
+ [Curve]_SpecularAnisoJitterMicro1 ("Micro Shift--{reference_properties:[_SpecularAnisoJitterMicro1Pan, _SpecularAnisoJitterMicro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMicroMultiplier1 ("Micro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMicro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMicro1UV ("UV", Int) = 0
+ [Curve]_SpecularAnisoJitterMacro1 ("Macro Shift--{reference_properties:[_SpecularAnisoJitterMacro1Pan, _SpecularAnisoJitterMacro1UV], condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", 2D) = "black" { }
+ _SpecularAnisoJitterMacroMultiplier1 ("Macro Multiplier--{condition_show:{type:OR,condition1:{type:PROPERTY_BOOL,data:_SpecularType1==3},condition2:{type:PROPERTY_BOOL,data:_SpecularType1==4}}}", Range(0, 10)) = 0
+ [HideInInspector][Vector2]_SpecularAnisoJitterMacro1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _SpecularAnisoJitterMacro1UV ("UV", Int) = 0
+ // Second Toon Specular
+ [MultiSlider]_SpecularToonInnerOuter1 ("Inner/Outer Edge--{condition_show:{type:PROPERTY_BOOL,data:_SpecularType1==2}}", Vector) = (0.25, 0.3, 0, 1)
+ [HideInInspector] m_end_specular1 ("Specular Reflections", Float) = 0
+
+ // First Emission
+ [HideInInspector] m_Special_Effects ("Special Effects", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission / Glow", Float) = 0
+ [ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMapUV ("UV", Int) = 0
+ _EmissionMask ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMaskUV ("UV", Int) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift ("Hue Shift", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed", Float) = 0
+
+ // Center out emission
+ [HideInInspector] m_start_CenterOutEmission ("Center Out Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionCenterOutEnabled ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission ("inward out emission", Float) = 0
+
+ // Glow in the dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [HideInInspector][ToggleUI]_EnableGITDEmission ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionBlinkingEnabled ("Enable Blinking", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions ("Blinking Emission", Float) = 0
+
+ // Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+ [HideInInspector][ToggleUI] _ScrollingEmission ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position", float) = 0
+ _EmissiveScroll_Direction ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity", Float) = 10
+ _EmissiveScroll_Interval ("Interval", Float) = 20
+ _EmissionScrollingOffset ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmissionOptions ("Scrolling Emission", Float) = 0
+
+ // Emission Audio Link
+ [HideInInspector] m_start_EmissionAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [ToggleUI] _EnableEmissionStrengthAudioLink ("multiply Emission Strength", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionStrengthBand ("Emission Strength Band", Int) = 0
+ [ToggleUI] _EnableEmissionCenterOutAudioLink ("Center Out multipy", Float) = 0
+ _EmissionCenterOutAudioLinkWidth("C Out Mul Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionCenterOutBand ("Center Out M Band", Int) = 0
+ [Vector2] _EmissionCenterOutAddAudioLink ("Center Out Add", Vector) = (0,0,0,0)
+ _EmissionCenterOutAddAudioLinkwidth("C Out Add Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmissionCenterOutAddBand ("Center Out A Band", Int) = 0
+ [Vector2]_AudioLinkAddEmission ("Emission Strength Add", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkAddEmissionBand ("Emission Add Band", Int) = 0
+ [HideInInspector] m_end_EmissionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_emissionOptions ("Emission / Glow", Float) = 0
+
+ // Second Enission
+ [HideInInspector] m_start_emission1Options ("Emission / Glow 2 (Requires Emission 1 Enabled)", Float) = 0
+ [ThryToggle(EFFECT_HUE_VARIATION)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color", Color) = (1, 1, 1, 1)
+ [Gradient]_EmissionMap1 ("Emission Map", 2D) = "white" { }
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMap1UV ("UV", Int) = 0
+ _EmissionMask1 ("Emission Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _EmissionMask1UV ("UV", Int) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ [ToggleUI]_EmissionHueShiftEnabled1 ("Enable Hue Shift", Float) = 0
+ _EmissionHueShift1 ("Hue Shift", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed", Float) = 0
+
+
+ // Second Center Out Enission
+ [HideInInspector] m_start_CenterOutEmission1 ("Center Out Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionCenterOutEnabled1 ("Enable Center Out", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed", Float) = 5
+ [HideInInspector] m_end_CenterOutEmission1 ("inward out emission", Float) = 0
+
+ // Second Glow In The Dark Emission
+ [HideInInspector] m_start_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+ [HideInInspector][ToggleUI]_EnableGITDEmission1 ("Enable Glow In The Dark", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting", Range(0, 1)) = 1
+ [HideInInspector] m_end_glowInDarkEmissionOptions1 ("Glow In The Dark Emission (Requires Lighting Enabled)", Float) = 0
+
+ // Second Blinking Emission
+ [HideInInspector] m_start_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+ [HideInInspector][ToggleUI]_EmissionBlinkingEnabled1 ("Enable Blinking", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_blinkingEmissionOptions1 ("Blinking Emission", Float) = 0
+
+ // Scrolling Scrolling Emission
+ [HideInInspector] m_start_scrollingEmissionOptions1 ("Scrolling Emission", Float) = 0
+ [HideInInspector][ToggleUI] _ScrollingEmission1 ("Enable Scrolling Emission", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position", float) = 0
+ _EmissiveScroll_Direction1 ("Direction", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval", Float) = 20
+ _EmissionScrollingOffset1 ("Offset", Float) = 0
+ [HideInInspector] m_end_scrollingEmission1Options ("Scrolling Emission", Float) = 0
+
+ // Emission Audio Link
+ [HideInInspector] m_start_Emission1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [ToggleUI] _EnableEmission1StrengthAudioLink ("Emission Strength", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1StrengthBand ("Emission Strength Band", Int) = 0
+ [ToggleUI] _EnableEmission1CenterOutAudioLink ("Center Out multipy", Float) = 0
+ _Emission1CenterOutAudioLinkWidth("C Out Mul Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band", Int) = 0
+ [Vector2] _EmissionCenterOutAddAudioLink1 ("Center Out Add", Vector) = (0,0,0,0)
+ _Emission1CenterOutAddAudioLinkwidth("C Out Add Duration", Range(0,1)) = 1
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutAddBand ("Center Out A Band", Int) = 0
+ [Vector2]_AudioLinkAddEmission1 ("Emission Strength Add", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkAddEmission1Band ("Emission Add Band", Int) = 0
+ [HideInInspector] m_end_Emission1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_emission1Options ("Emission / Glow 2", Float) = 0
+
+ // Poiyomi Pathing
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(TONEMAPPING_CUSTOM)] _EnablePathing ("Enable Pathing", Float) = 0
+ _PathingMap ("RGB Path Map | A Mask--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ _PathingColorMap ("RGB Color | A Mask--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _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
+ [HDR]_PathColorR ("R Color", Color) = (1, 1, 1)
+ [HDR]_PathColorG ("G Color", Color) = (1, 1, 1)
+ [HDR]_PathColorB ("B Color", Color) = (1, 1, 1)
+ [Vector3]_PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 1)
+ [Vector3]_PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ [Vector3]_PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1)
+ [Vector3]_PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 1)
+ [Header(Timing Options)]
+ [Vector3]_PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, 1)
+ [Vector3]_PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 1)
+ [Vector3]_PathSegments ("Path Segments", Vector) = (0.0, 0.0, 0.0, 1)
+ [HideInInspector] m_start_PathAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ // Time Offsets
+ [Header(Time Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B", Vector) = (0, 0, 0)
+
+ // Emission Offsets
+ [Header(Emission Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Emission R", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Emission G", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Emission B", Vector) = (0, 0, 0, 0)
+
+ // Length Offsets
+ [Header(Length Offset)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_PathAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_pathing ("Pathing", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook", Float) = 0
+ [ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array", 2DArray) = "" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _FlipbookTexArrayUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _FlipbookMaskUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ _FlipbookColor ("Color & alpha", Color) = (1, 1, 1, 1)
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale("Scale Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha("Alpha Mod", Vector) = (1,1,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission("Emission Mod", Vector) = (0,0,0,0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame("Frame control", Vector) = (0,0,0,0)
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+
+ // Flipbook Manual Control
+ [HideInInspector] m_start_manualFlipbookControl ("Manual Control", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame", Float) = -1
+ [HideInInspector] m_end_manualFlipbookControl ("Manual Control", Float) = 0
+
+ [HideInInspector] m_start_crossfade ("Crossfade", Float) = 0
+ [ToggleUI]_FlipbookCrossfadeEnabled("Enable Crossfade?", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range", Vector) = (0.75, 1, 0, 1)
+ [HideInInspector] m_end_crossfade ("Crossfade", Float) = 0
+
+ [HideInInspector] m_start_flipbookHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_FlipbookHueShiftEnabled ("Enabled", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed", Float) = 0
+ _FlipbookHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_flipbookHueShift ("Hue Shift", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve", Float) = 0
+ [ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color", Color) = (1, 1, 1, 1)
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color", Color) = (1, 1, 1, 1)
+ _DissolveToTexture ("Dissolved Texture", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask", 2D) = "white" { }
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _DissolveMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+ [HideInInspector] m_start_dissolveMasking ("Effect Masking", Float) = 0
+ [Enum(Undissolved, 0, Dissolved, 1, Both, 2)] _DissolveEmissionSide ("Emission 1", Int) = 2
+ [Enum(Undissolved, 0, Dissolved, 1, Both, 2)] _DissolveEmission1Side ("Emission 2", Int) = 2
+ [HideInInspector] m_end_dissolveMasking ("Effect Masking", Float) = 0
+
+ // Point to Point Dissolve
+ [HideInInspector] m_start_pointToPoint ("point to point", Float) = 0
+ [Enum(Local, 0, World, 1, Vertex Colors, 2)] _DissolveP2PWorldLocal ("World/Local", Int) = 0
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0,1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+
+ [HideInInspector] m_start_dissolveAudioLink ("Audio Link ♫--{reference_property:_EnableDissolveAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDissolveAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_dissolveAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Panosphere
+ [HideInInspector] m_start_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+ [ThryToggle(_DETAIL_MULX2)]_PanoToggle ("Enable Panosphere", Float) = 0
+ [ToggleUI]_PanoInfiniteStereoToggle ("Infinite Stereo", Float) = 0
+ _PanosphereColor ("Color", Color) = (1, 1, 1, 1)
+ _PanosphereTexture ("Texture", 2D) = "white" { }
+ _PanoMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_PanoMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _PanoMaskUV ("UV", Int) = 0
+ _PanoEmission ("Emission Strength", Range(0, 10)) = 0
+ _PanoBlend ("Alpha", Range(0, 1)) = 0
+ [Vector3]_PanospherePan ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_PanoCubeMapToggle ("Use Cubemap", Float) = 0
+ [TextureNoSO]_PanoCubeMap ("CubeMap", Cube) = "" { }
+ [HideInInspector] m_end_panosphereOptions ("Panosphere / Cubemaps", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle", Float) = 0
+ [ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [Enum(Angle, 0, Linear Emission, 1)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color", Color) = (1, 1, 1)
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0,0,0,0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==0}}", Range(0, 1)) = .8
+ _GlitterHideInShadow("Hide in shadow", Range(0,1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [HideInInspector] m_start_glitterHueShift ("Hue Shift", Float) = 0
+ [ToggleUI]_GlitterHueShiftEnabled ("Enabled", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed", Float) = 0
+ _GlitterHueShift ("Hue Shift", Range(0,1)) = 0
+ [HideInInspector] m_end_glitterHueShift ("Hue Shift", Float) = 0
+
+ // Glitter Random Colors
+ [HideInInspector] m_start_glitterRandom ("Random Things", Float) = 0
+ [ToggleUI]_GlitterRandomColors ("Random Colors", Float) = 0
+ [MultiSlider]_GlitterMinMaxSaturation ("Saturation Range", Vector) = (0.8, 1, 0, 1)
+ [MultiSlider]_GlitterMinMaxBrightness ("Brightness Range", Vector) = (0.8, 1, 0, 1)
+ [ToggleUI]_GlitterRandomSize("Random Size?", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation("Random Tex Rotation", Float) = 0
+ [HideInInspector] m_end_glitterRandom ("Random Colors", Float) = 0
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("MSDF Text Overlay", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS", Float) = 0
+ [ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color", Color) = (1, 1, 1, 1)
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextFPSPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextFPS ("FPS", Float) = 0
+
+ // POSITION
+ [HideInInspector] m_start_TextPosition ("Position", Float) = 0
+ [ToggleUI]_TextPositionEnabled ("Position Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color", Color) = (1, 0, 1, 1)
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextPositionPadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextPosition ("Position", Float) = 0
+
+ // INSTANCE TIME
+ [HideInInspector] m_start_TextInstanceTime ("Instance Time", Float) = 0
+ [ToggleUI]_TextTimeEnabled ("Time Text?", Float) = 0
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color", Color) = (1, 0, 1, 1)
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror", Float) = 0
+ [ThryToggle(_REQUIRE_UV2)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [Enum(ShowInBoth, 0, ShowOnlyInMirror, 1, DontShowInMirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ [ToggleUI]_EnableMirrorTexture ("Enable Mirror Texture", Float) = 0
+ _MirrorTexture ("Mirror Tex", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MirrorTextureUV ("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ // Distance Fade
+ [HideInInspector] m_start_distanceFade ("Distance Fade", Float) = 0
+ _MainFadeTexture ("Fade Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainFadeTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _MainFadeTextureUV ("UV", Int) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _MainFadeType ("Pos To Use", Int) = 1
+ _MainMinAlpha ("Minimum Alpha", Range(0, 1)) = 0
+ _MainMaxAlpha ("Maximum Alpha", Range(0, 1)) = 1
+ _MainDistanceFadeMin ("Distance Min", Float) = 0
+ _MainDistanceFadeMax ("Distance Max", Float) = 0
+ [HideInInspector] m_end_distanceFade ("Distance Fade", Float) = 0
+
+ // Angular Fade
+ [HideInInspector] m_start_angularFade ("Angular Fade", Float) = 0
+ [ThryToggle(_SUNDISK_NONE)]_EnableRandom ("Enable Angular Fade", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction", Vector) = (0, 0, 1, 0)
+ _CameraAngleMin ("Camera Angle Min", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_angularFade ("Angular Fade", Float) = 0
+
+ // UV Distortion
+ [HideInInspector] m_start_distortionFlow ("UV Distortion", Float) = 0
+ [ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1", 2D) = "black" { }
+ _DistortionFlowTexture1 ("Distortion Texture 2", 2D) = "black" { }
+ _DistortionStrength ("Strength1", Float) = 0.5
+ _DistortionStrength1 ("Strength2", Float) = 0.5
+ [Vector2]_DistortionSpeed ("Speed1", Vector) = (0.5, 0.5, 0, 0)
+ [Vector2]_DistortionSpeed1 ("Speed2", Vector) = (0.5, 0.5, 0, 0)
+
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_distortionFlow ("UV Distortion", Float) = 0
+
+ // Audio link
+ [HideInInspector] m_start_audioLink ("Audio Link--{reference_property:_EnableAudioLink}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_LOG_VIEW)] _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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ _AudioLinkDelay ("Delay", Range(0,1)) = 0
+ [ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ _AudioLinkAverageRange ("Average Sampling Range", Range(0,1)) = .5
+ // Debug
+ [HideInInspector] m_start_audioLinkDebug ("Debug--{reference_property:_EnableAudioLinkDebug}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableAudioLinkDebug("Enable?", Float) = 0
+ _AudioLinkDebugTreble ("Treble", Range(0,1)) = 0
+ _AudioLinkDebugHighMid ("High Mid", Range(0,1)) = 0
+ _AudioLinkDebugLowMid ("Low Mid", Range(0,1)) = 0
+ _AudioLinkDebugBass ("Bass", Range(0,1)) = 0
+ [ToggleUI] _AudioLinkDebugAnimate ("Debug Animate", Float) = 0
+ [ToggleUI]_AudioLinkTextureVisualization("Visualize Texture", Float) = 0
+ [HideInInspector] m_end_audioLinkDebug ("Debug", Float) = 0
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ // Start Patreon
+ [HideInInspector] m_Patreon ("Patreon (Pro Only)", Float) = 0
+ [Helpbox(1)] _PatreonHelpBox("This section is included to let people know what's included in the pro shader. Nothing here can be used in toon. Feel free to hide this section with the custom UI dropdown at the top of the material.", Int) = 0
+ // Video Options
+ [HideInInspector] m_start_Video ("Video", Float) = 0
+ [HideInInspector] m_start_VideoSettings ("Video Texture Settings", Float) = 0
+ [HideInInspector] m_end_VideoSettings ("Video Texture Settings", Float) = 0
+ [HideInInspector] m_start_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_end_VideoDebug ("Video Debug", Float) = 0
+ [HideInInspector] m_start_CRT ("CRT Options", Float) = 0
+ [HideInInspector] m_end_CRT ("CRT Options", Float) = 0
+ [HideInInspector] m_start_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Gameboy ("Gameboy Options", Float) = 0
+ [HideInInspector] m_end_Video ("Video", Float) = 0
+
+ // TouchFX
+ [HideInInspector] m_start_TouchOptions ("Touch FX", Float) = 0
+ [HideInInspector] m_start_Bulge ("Bulge", Float) = 0
+ [HideInInspector] m_end_Bulge ("Bulge", Float) = 0
+
+ [HideInInspector] m_start_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchGlow ("Touch Color", Float) = 0
+ [HideInInspector] m_end_TouchOptions ("Touch FX", Float) = 0
+
+ // Hologram
+ [HideInInspector] m_start_Hologram ("Hologram Alpha", Float) = 0
+ [HideInInspector] m_start_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_FresnelAlpha ("Fresnel Alpha", Float) = 0
+ [HideInInspector] m_end_Hologram ("Hologram Alpha", Float) = 0
+
+ // GrabPass
+ [HideInInspector] m_start_GrabPass ("GrabPass Transparency", Float) = 0
+ [HideInInspector] m_start_Refraction ("Refraction", Float) = 0
+ [HideInInspector] m_end_Refraction ("Refraction", Float) = 0
+ [HideInInspector] m_start_Blur ("Blur", Float) = 0
+ [HideInInspector] m_end_Blur ("Blur", Float) = 0
+ [HideInInspector] m_end_GrabPass ("GrabPass Transparency", Float) = 0
+
+ // Iridescence
+ [HideInInspector] m_start_Iridescence ("Iridescence", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // Vertex Glitching
+ [HideInInspector] m_start_VertexGlitch ("Vertex Glitching", Float) = 0
+ [HideInInspector] m_end_VertexGlitch ("Vertex Glitching", Float) = 0
+
+ // Spawn In Effects
+ [HideInInspector] m_start_Spawns ("Spawns", Float) = 0
+ [HideInInspector] m_start_ScifiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_SciFiSpawnIn ("Sci Fi", Float) = 0
+ [HideInInspector] m_end_Spawns ("Spawns", Float) = 0
+
+ // Voronoi
+ [HideInInspector] m_start_Voronoi ("Voronoi", Float) = 0
+ [HideInInspector] m_start_voronoiRandom ("Voronoi Random Cell Color", Float) = 0
+ [HideInInspector] m_end_voronoiRandom ("Voronoi Random Cell Color", Float) = 0
+ [HideInInspector] m_end_Voronoi ("Vertex Glitching", Float) = 0
+
+ [HideInInspector] m_start_BlackLight ("Black Light Mask", Float) = 0
+ [HideInInspector] m_end_BlackLight ("Black Light", Float) = 0
+ // End Patreon
+
+ // Outline Options
+ [HideInInspector] m_outlineOptions ("Outlines", Float) = 0
+ [ToggleUI]_commentIfZero_EnableOutlinePass ("Enable Outlines", float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ _OutlineTintMix ("Tint Mix--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==1}}", Range(0, 1)) = 0
+ _OutlineRimLightBlend ("Rim Light Blend--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==2}}", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==3}}", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==4}}", Vector) = (1, 0, 0, 0)
+ [ToggleUI]_OutlineFixedSize ("Fixed Size?", Float) = 0
+ _OutlinesMaxDistance ("Fixed Size Max Distance", Float) = 9999
+ [Enum(Off, 0, Normals, 1, Mask VC.r, 2)]_OutlineUseVertexColors ("Vertex Color", Float) = 0
+ [ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color", Color) = (1, 1, 1, 1)
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _OutlineTexture ("Outline Texture--{reference_properties:[_OutlineTexturePan, _OutlineTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineTexturePan ("Outline Texture Pan", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _OutlineTextureUV ("UV", Int) = 0
+ _OutlineMask ("Outline Mask--{reference_properties:[_OutlineMaskPan, _OutlineMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _OutlineMaskUV ("UV", Int) = 0
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+ [Header(Hue Shift)]
+ [ToggleUI]_OutlineHueShift ("Hue Shift?", Float) = 0
+ _OutlineHueOffset ("Shift", Range(0, 1)) = 0
+ _OutlineHueOffsetSpeed ("Shift Speed", Float) = 0
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ [Vector2]_OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ _OutlineOffsetFactor("Offset Factor", Float) = 0
+ _OutlineOffsetUnits("Offset Units", Float) = 0
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ // Parallax Mapping
+ [HideInInspector] m_ParallaxMap ("Parallax", Float) = 0
+ [ThryToggle(_PARALLAXMAP)]_ParallaxMap ("Enable Parallax FX", Float) = 0
+ [ToggleUI]_ParallaxHeightMapEnabled ("Enable Parallax Height", Float) = 0
+ [ToggleUI]_ParallaxInternalMapEnabled ("Enable Parallax Internal", Float) = 0
+ [HideInInspector] m_start_parallaxHeightmap ("Heightmap", Float) = 0
+ [Vector2]_ParallaxHeightMapPan ("Pan", Vector) = (0, 0, 0, 0)
+ [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _ParallaxUV ("Parallax UV", Int) = 0
+ _ParallaxHeightMap ("Height Map", 2D) = "black" { }
+ _ParallaxHeightMapMask ("Mask", 2D) = "white" { }
+ [HideInInspector][Vector2]_ParallaxHeightMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _ParallaxHeightMapMaskUV ("UV", Int) = 0
+ _ParallaxStrength ("Parallax Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_parallaxHeightmap ("Heightmap", Float) = 0
+ [HideInInspector] m_start_parallaxInternal ("Internal", Float) = 0
+ [Enum(Basic, 0, HeightMap, 1)] _ParallaxInternalHeightmapMode ("Parallax Mode", Int) = 0
+ [ToggleUI]_ParallaxInternalHeightFromAlpha ("HeightFromAlpha", Float) = 0
+ _ParallaxInternalMap ("Internal Map", 2D) = "black" { }
+ _ParallaxInternalMapMask ("Mask", 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
+ _ParallaxInternalIterations ("Parallax Internal Iterations", Range(1, 50)) = 1
+ _ParallaxInternalMinDepth ("Min Depth", Float) = 0
+ _ParallaxInternalMaxDepth ("Max Depth", Float) = 1
+ _ParallaxInternalMinFade ("Min Depth Brightness", Range(0, 5)) = 0
+ _ParallaxInternalMaxFade ("Max Depth Brightness", Range(0, 5)) = 1
+ _ParallaxInternalMinColor ("Min Depth Color", Color) = (1, 1, 1, 1)
+ _ParallaxInternalMaxColor ("Max Depth Color", Color) = (1, 1, 1, 1)
+ [Vector2]_ParallaxInternalPanSpeed ("Pan Speed", Vector) = (0, 0, 0, 0)
+ [Vector2]_ParallaxInternalPanDepthSpeed ("Per Level Speed Multiplier", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_parallaxInternal ("Internal", Float) = 0
+ [HideInInspector] m_start_parallaxAdvanced ("Advanced", Float) = 0
+ _ParallaxBias ("Parallax Bias (0.42)", Float) = 0.42
+ [HideInInspector] m_end_parallaxAdvanced ("Advanced", Float) = 0
+
+ [HideInInspector] m_PostProcessing ("Post Processing", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section is designed for you to make adjustments to your final look in game through animations not to permentantly change settings before uploading.", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+
+ // Rendering Options
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Outline Stencil
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil--{ condition_show:{type:PROPERTY_BOOL,data:_commentIfZero_EnableOutlinePass==1}}", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _OutlineStencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ // Debug Options
+ [HideInInspector] m_start_debugOptions ("Debug", Float) = 0
+ [HideInInspector][ThryToggle(_COLOROVERLAY_ON)]_DebugEnabled ("Display Debug Info", Float) = 0
+ _VertexUnwrap ("Unwrap", Range(0, 1)) = 0
+ [Enum(Off, 0, Vertex Normal, 1, Pixel Normal, 2, Tangent, 3, Binormal, 4, Local 0 Distance, 5)] _DebugMeshData ("Mesh Data", Int) = 0
+ [Enum(Off, 0, Attenuation, 1, Direct Lighting, 2, Indirect Lighting, 3, light Map, 4, Ramped Light Map, 5, Final Lighting, 6)] _DebugLightingData ("Lighting Data", Int) = 0
+ [Enum(Off, 0, View Dir, 1, Tangent View Dir, 2, Forward Dir, 3, WorldPos, 4, View Dot Normal, 5)] _DebugCameraData ("Camera Data", Int) = 0
+ [HideInInspector] m_end_debugOptions ("Debug", Float) = 0
+ }
+
+
+ //originalEditorCustomEditor "PoiToon"
+ CustomEditor "Thry.ShaderEditor"
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry+10" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToMask]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_BASE_PASS
+ float _Mode;
+ // Base Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // Pathing
+ #pragma shader_feature TONEMAPPING_CUSTOM
+ // patreon Base
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ //Audio Link
+ #pragma shader_feature COLOR_GRADING_LOG_VIEW
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Grab Pass Blur
+ #pragma shader_feature CHROMATIC_ABERRATION_LOW
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Touch Color
+ #pragma shader_feature GRAIN
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Emission 1
+ #pragma shader_feature _EMISSION
+ // Emission 2
+ #pragma shader_feature EFFECT_HUE_VARIATION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Name "ForwardAddPass"
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ ZWrite Off
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend One One
+ Cull [_Cull]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_ADD_PASS
+ float _Mode;
+ // Add Pass Features
+ // Decal
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+ // Pathing
+ #pragma shader_feature TONEMAPPING_CUSTOM
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Bulge
+ #pragma shader_feature BLOOM_LOW
+ //Audio Link
+ #pragma shader_feature COLOR_GRADING_LOG_VIEW
+ #pragma shader_feature _PARALLAX_MAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // Disable Directionals
+ #pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
+ // Emission
+ #pragma shader_feature _EMISSION
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+
+ //EnableOutlinePass
+ Pass
+ {
+ Name "Outline"
+ Tags { "LightMode" = "ForwardBase" }
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ ReadMask [_OutlineStencilReadMask]
+ WriteMask [_OutlineStencilWriteMask]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OutlineOffsetFactor], [_OutlineOffsetUnits]
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ AlphaToMask [_AlphaToMask]
+ Cull [_OutlineCull]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define FORWARD_BASE_PASS
+ #define OUTLINE
+ float _Mode;
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ // patreon Additive
+ // Black Light Mask
+ #pragma shader_feature _SPECULARHIGHLIGHTS_OFF
+ // voronoi
+ #pragma shader_feature CHROMATIC_ABERRATION
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ #pragma multi_compile_fwdbase
+ #pragma fragmentoption ARB_precision_hint_fastest
+ #pragma multi_compile_fog
+ #pragma multi_compile_instancing
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPassOutline.cginc"
+ ENDCG
+
+ }
+ //EnableOutlinePass
+
+ //LightingCastShadows
+ Pass
+ {
+ Name "ShadowCasterPass"
+ Tags { "LightMode" = "ShadowCaster" }
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+ AlphaToMask Off
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define POI_SHADOW
+ float _Mode;
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Vertex Offsets
+ #pragma shader_feature AUTO_EXPOSURE
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Dissolve
+ #pragma shader_feature DISTORT
+ #pragma multi_compile_instancing
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "../Includes/CGI_PoiPassShadow.cginc"
+ ENDCG
+
+ }
+ //LightingCastShadows
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+ Cull Off
+ CGPROGRAM
+
+ #pragma target 5.0
+ #define POI_META_PASS
+ float _Mode;
+ // UV Distortion
+ #pragma shader_feature USER_LUT
+ // Hologram Alpha
+ #pragma shader_feature DEPTH_OF_FIELD
+ //Video
+ #pragma shader_feature BLOOM
+ #pragma shader_feature _PARALLAXMAP
+ // Mirror
+ #pragma shader_feature _REQUIRE_UV2
+ // Random
+ #pragma shader_feature _SUNDISK_NONE
+ // Hue Shift
+ #pragma shader_feature COLOR_GRADING_HDR
+ // Dissolve
+ #pragma shader_feature DISTORT
+ // Panosphere
+ #pragma shader_feature _DETAIL_MULX2
+ // Lighting
+ #pragma shader_feature VIGNETTE_MASKED
+ // Flipbook
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+ // Rim Lighting
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ // Enviro Rim
+ #pragma shader_feature _MAPPING_6_FRAMES_LAYOUT
+ // Metal
+ #pragma shader_feature _METALLICGLOSSMAP
+ // Poi Shader Model
+ #pragma shader_feature VIGNETTE_CLASSIC
+ // Iridescence
+ #pragma shader_feature BLOOM_LENS_DIRT
+ // Matcap
+ #pragma shader_feature _COLORADDSUBDIFF_ON
+ // Matcap 2
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ // Specular
+ #pragma shader_feature _SPECGLOSSMAP
+ // Specular 2
+ #pragma shader_feature DITHERING
+ // SubSurface
+ #pragma shader_feature _TERRAIN_NORMAL_MAP
+ // Debug
+ #pragma shader_feature _COLOROVERLAY_ON
+ // Glitter
+ #pragma shader_feature _SUNDISK_SIMPLE
+ // RGBMask
+ #pragma shader_feature VIGNETTE
+ // RGB NORMALS
+ #pragma shader_feature GEOM_TYPE_MESH
+ //Details
+ #pragma shader_feature FINALPASS
+ // Text
+ #pragma shader_feature EFFECT_BUMP
+ // Emission 1
+ #pragma shader_feature _EMISSION
+ // Emission 2
+ #pragma shader_feature EFFECT_HUE_VARIATION
+ // Clear Coat
+ #pragma shader_feature _COLORCOLOR_ON
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "../Includes/CGI_PoiPass.cginc"
+ ENDCG
+
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Toon.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Toon.shader.meta
new file mode 100644
index 00000000..c18e085b
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/7.3/Pro/Shaders/S_Poiyomi_Toon.shader.meta
@@ -0,0 +1,103 @@
+fileFormatVersion: 2
+guid: 917b37092bae034459c28c00a3a19b54
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _MainTex: {fileID: 2800000, guid: a6d6984545cde4a4f9317b17d6dca225, type: 3}
+ - _BumpMap: {instanceID: 0}
+ - _ClippingMask: {instanceID: 0}
+ - _MainColorAdjustTexture: {instanceID: 0}
+ - _RGBMask: {instanceID: 0}
+ - _RedTexure: {instanceID: 0}
+ - _GreenTexture: {instanceID: 0}
+ - _BlueTexture: {instanceID: 0}
+ - _AlphaTexture: {instanceID: 0}
+ - _RgbNormalR: {instanceID: 0}
+ - _RgbNormalG: {instanceID: 0}
+ - _RgbNormalB: {instanceID: 0}
+ - _RgbNormalA: {instanceID: 0}
+ - _DetailMask: {instanceID: 0}
+ - _DetailTex: {instanceID: 0}
+ - _DetailNormalMap: {instanceID: 0}
+ - _VertexManipulationHeightMask: {instanceID: 0}
+ - _DecalMask: {instanceID: 0}
+ - _DecalTexture: {instanceID: 0}
+ - _DecalTexture1: {instanceID: 0}
+ - _DecalTexture2: {instanceID: 0}
+ - _DecalTexture3: {instanceID: 0}
+ - _BackFaceTexture: {instanceID: 0}
+ - _1st_ShadeMap: {instanceID: 0}
+ - _2nd_ShadeMap: {instanceID: 0}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ - _LightingShadowMask: {instanceID: 0}
+ - _SkinLUT: {instanceID: 0}
+ - _LightingDetailShadows: {instanceID: 0}
+ - _LightingAOTex: {instanceID: 0}
+ - _SSSThicknessMap: {instanceID: 0}
+ - _RimTex: {instanceID: 0}
+ - _RimMask: {instanceID: 0}
+ - _RimWidthNoiseTexture: {instanceID: 0}
+ - _RimEnviroMask: {instanceID: 0}
+ - _BRDFMetallicGlossMap: {instanceID: 0}
+ - _BRDFSpecularMap: {instanceID: 0}
+ - _BRDFMetallicMap: {instanceID: 0}
+ - _BRDFFallback: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ - _CubeMap: {fileID: 8900000, guid: 1f79f71b84fc2844bb81e9ae4f5bc384, type: 3}
+ - _MetallicTintMap: {instanceID: 0}
+ - _MetallicMask: {instanceID: 0}
+ - _SmoothnessMask: {instanceID: 0}
+ - _ClearcoatMap: {instanceID: 0}
+ - _ClearcoatFallback: {instanceID: 0}
+ - _Matcap: {instanceID: 0}
+ - _MatcapMask: {instanceID: 0}
+ - _Matcap2: {instanceID: 0}
+ - _Matcap2Mask: {instanceID: 0}
+ - _SpecularMetallicMap: {instanceID: 0}
+ - _SpecularMap: {instanceID: 0}
+ - _SpecularMask: {instanceID: 0}
+ - _AnisoTangentMap: {instanceID: 0}
+ - _SpecularAnisoJitterMicro: {instanceID: 0}
+ - _SpecularAnisoJitterMacro: {instanceID: 0}
+ - _SpecularMetallicMap1: {instanceID: 0}
+ - _SpecularMap1: {instanceID: 0}
+ - _SpecularMask1: {instanceID: 0}
+ - _AnisoTangentMap1: {instanceID: 0}
+ - _SpecularAnisoJitterMicro1: {instanceID: 0}
+ - _SpecularAnisoJitterMacro1: {instanceID: 0}
+ - _EmissionMap: {instanceID: 0}
+ - _EmissionMask: {instanceID: 0}
+ - _EmissionScrollingCurve: {instanceID: 0}
+ - _EmissionMap1: {instanceID: 0}
+ - _EmissionMask1: {instanceID: 0}
+ - _EmissionScrollingCurve1: {instanceID: 0}
+ - _PathingMap: {instanceID: 0}
+ - _PathingColorMap: {instanceID: 0}
+ - _FlipbookTexArray: {instanceID: 0}
+ - _FlipbookMask: {instanceID: 0}
+ - _DissolveEdgeGradient: {instanceID: 0}
+ - _DissolveToTexture: {instanceID: 0}
+ - _DissolveNoiseTexture: {instanceID: 0}
+ - _DissolveDetailNoise: {instanceID: 0}
+ - _DissolveMask: {instanceID: 0}
+ - _PanosphereTexture: {instanceID: 0}
+ - _PanoMask: {instanceID: 0}
+ - _PanoCubeMap: {instanceID: 0}
+ - _GlitterColorMap: {instanceID: 0}
+ - _GlitterMask: {instanceID: 0}
+ - _GlitterTexture: {instanceID: 0}
+ - _TextGlyphs: {instanceID: 0}
+ - _MirrorTexture: {instanceID: 0}
+ - _MainFadeTexture: {instanceID: 0}
+ - _DistortionMask: {instanceID: 0}
+ - _DistortionFlowTexture: {instanceID: 0}
+ - _DistortionFlowTexture1: {instanceID: 0}
+ - _OutlineTexture: {instanceID: 0}
+ - _OutlineMask: {instanceID: 0}
+ - _ParallaxHeightMap: {instanceID: 0}
+ - _ParallaxHeightMapMask: {instanceID: 0}
+ - _ParallaxInternalMap: {instanceID: 0}
+ - _ParallaxInternalMapMask: {instanceID: 0}
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0.meta
new file mode 100644
index 00000000..0b40f4c4
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: adef60d2bcaf34f45912898fa1436ecb
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Early Outline.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Early Outline.shader
new file mode 100644
index 00000000..0d1d47b5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Early Outline.shader
@@ -0,0 +1,27986 @@
+Shader ".poiyomi/Poiyomi 8.0/Poiyomi Outline Early"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.0.303</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:32},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:32},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:32},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:32},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:32},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [KeywordEnum(TextureRamp, Multilayer Math, Wrapped, Skin, ShadeMap, Flat, Realistic, Cloth)] _LightingMode ("Lighting Type", Float) = 5
+ _LightingShadowColor ("Shadow Tint--{condition_showS:(_LightingMode!=4 && _LightingMode!=1 && _LightingMode!=5)}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ /*
+ _SDFShadingTexture ("LUT--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ */
+ // Generic
+ _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode<=4)}", Range(0, 1)) = 1
+ _LightingIgnoreAmbientColor ("Ignore Ambient Color--{condition_showS:(_LightingMode<=3)}", Range(0, 1)) = 0
+
+ // Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0,1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Outlines
+ [HideInInspector] m_OutlineCategory (" Outlines--{reference_property:_EnableOutlines}", Float) = 0
+ // Outline Vertex
+ [HideInInspector][ToggleUI]_EnableOutlines ("Enable Outlines", float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ [Enum(Local, 0, World, 1)]_OutlineSpace ("Space", Int) = 0
+ _OutlineTintMix ("Tint Mix--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==1}}", Range(0, 1)) = 0
+ _OutlineRimLightBlend ("Rim Light Blend--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==2}}", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==3}}", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==4}}", Vector) = (1, 0, 0, 0)
+ [ToggleUI]_OutlineFixedSize ("Fixed Size?", Float) = 0
+ _OutlinesMaxDistance ("Fixed Size Max Distance", Float) = 9999
+ [Enum(Off, 0, Normals, 1, Mask VC.r, 2)]_OutlineUseVertexColors ("Vertex Color", Float) = 0
+ [ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color--{reference_property:_LineColorThemeIndex}", 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)] _LineColorThemeIndex ("", Int) = 0
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _OutlineTextureUV ("UV", Int) = 0
+ _OutlineMask ("Outline Mask--{reference_properties:[_OutlineMaskPan, _OutlineMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _OutlineMaskUV ("UV", Int) = 0
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+
+ [ThryToggleUI(true)]_OutlineHueShift ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _OutlineHueOffset ("Shift--{condition_showS:(_OutlineHueShift==1)}", Range(0, 1)) = 0
+ _OutlineHueOffsetSpeed ("Shift Speed--{condition_showS:(_OutlineHueShift==1)}", Float) = 0
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ [ToggleUI]_OutlineClipAtZeroWidth ("Clip 0 Width", Float) = 0
+ [ToggleUI]_OutlineOverrideAlpha ("Override Base Alpha", Float) = 0
+ _Offset_Z ("Cam Z Offset", Float) = 0
+ [Vector2]_OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineZTest ("ZTest", Float) = 4
+ _OutlineOffsetFactor ("Offset Factor", Float) = 0
+ _OutlineOffsetUnits ("Offset Units", Float) = 0
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Outline Stencil
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _OutlineStencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ // Outline Blending Options
+ [HideInInspector] m_start_outlineBlending ("Outline Blending", Float) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _OutlineSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _OutlineDstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_end_outlineBlending ("Outline Blending", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ ReadMask [_OutlineStencilReadMask]
+ WriteMask [_OutlineStencilWriteMask]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+
+ /*
+ ColorMask [_ColorMask]
+ Offset [_OutlineOffsetFactor], [_OutlineOffsetUnits]
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ AlphaToMask [_AlphaToCoverage]
+ Cull [_OutlineCull]
+ */
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_OutlineZTest]
+ Cull [_OutlineCull]
+ Blend [_OutlineSrcBlend] [_OutlineDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_OUTLINE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_PASS_OUTLINE
+ // outline Vertex Options
+ float _OutlineMode;
+ float4 _OutlinePersonaDirection;
+ float4 _OutlineDropShadowOffset;
+ float _OutlineUseVertexColors;
+ float _OutlineFixedSize;
+ float _EnableOutlines;
+ float _OutlinesMaxDistance;
+ float _LineWidth;
+ float _OutlineEmission;
+ float4 _LineColor;
+ float _OutlineOverrideAlpha;
+ float _OutlineSpace;
+ texture2D _OutlineTexture; //TODO make this dynamically not read for lock in
+ float4 _OutlineTexture_ST;
+ float2 _OutlineTexturePan;
+ float _OutlineTextureUV;
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+ sampler2D _OutlineMask;
+ float4 _OutlineMask_ST;
+ float2 _OutlineMaskPan;
+ float _OutlineMaskUV;
+ float _OutlineRimLightBlend;
+ float _OutlineLit;
+ float _OutlineTintMix;
+ half _OutlineHueOffset;
+ half _OutlineHueShift;
+ half _OutlineHueOffsetSpeed;
+ float _OutlineShadowStrength;
+ float _LineColorThemeIndex;
+ float _Offset_Z;
+ float _OutlineClipAtZeroWidth;
+ #endif
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_PASS_OUTLINE
+ void applyOutlineColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ clip(_EnableOutlines - 0.01);
+ float OutlineMask = tex2D(_OutlineMask, TRANSFORM_TEX(poiMesh.uv[_OutlineMaskUV], _OutlineMask) + _Time.x * _OutlineMaskPan).r;
+ if (_OutlineClipAtZeroWidth)
+ {
+ clip(OutlineMask * _LineWidth - 0.001);
+ }
+ float4 col = POI2D_SAMPLER_PAN(_OutlineTexture, _MainTex, poiUV(poiMesh.uv[_OutlineTextureUV], _OutlineTexture_ST), _OutlineTexturePan) * float4(poiThemeColor(poiMods, _LineColor.rgb, _LineColorThemeIndex), _LineColor.a);
+ //UNITY_BRANCH
+ if (_OutlineMode == 0)
+ {
+ poiFragData.baseColor = col;
+ }
+ //UNITY_BRANCH
+ if (_OutlineMode == 1)
+ {
+ poiFragData.baseColor = lerp(float4(poiThemeColor(poiMods, _LineColor.rgb, _LineColorThemeIndex), _LineColor.a), poiFragData.baseColor, _OutlineTintMix) * col;
+ }
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiLight.directColor, _OutlineRimLightBlend) * col;
+ }
+
+ if (_OutlineOverrideAlpha)
+ {
+ poiFragData.alpha = col.a;
+ }
+ else
+ {
+ poiFragData.alpha *= col.a;
+ }
+
+ // Hue shift
+ //UNITY_BRANCH
+ if (_OutlineHueShift)
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, _OutlineHueOffset +_OutlineHueOffsetSpeed * _Time.x);
+ }
+
+ poiFragData.emission += poiFragData.baseColor * _OutlineEmission;
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_PASS_OUTLINE
+ applyOutlineColor(poiFragData, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ /*
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ */
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap.a, matcapMask * _MatcapAlphaOverride);
+
+ //UNITY_BRANCH
+ if (_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap2.a, matcap2Mask * _Matcap2AlphaOverride);
+
+ //UNITY_BRANCH
+ if (_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1,FresnelLerp(specCol, grazingTerm, poiLight.nDotV),_RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap.a, matcapMask * _MatcapAlphaOverride);
+
+ //UNITY_BRANCH
+ if (_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap2.a, matcap2Mask * _Matcap2AlphaOverride);
+
+ //UNITY_BRANCH
+ if (_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1,FresnelLerp(specCol, grazingTerm, poiLight.nDotV),_RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Early Outline.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Early Outline.shader.meta
new file mode 100644
index 00000000..ec8c8e54
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Early Outline.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: 1513582543e8f6c44b1981e8689f7a52
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Outline.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Outline.shader
new file mode 100644
index 00000000..095d2e2c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Outline.shader
@@ -0,0 +1,27986 @@
+Shader ".poiyomi/Poiyomi 8.0/Poiyomi Outline"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.0.303</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:32},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:32},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:32},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:32},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:32},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [KeywordEnum(TextureRamp, Multilayer Math, Wrapped, Skin, ShadeMap, Flat, Realistic, Cloth)] _LightingMode ("Lighting Type", Float) = 5
+ _LightingShadowColor ("Shadow Tint--{condition_showS:(_LightingMode!=4 && _LightingMode!=1 && _LightingMode!=5)}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ /*
+ _SDFShadingTexture ("LUT--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ */
+ // Generic
+ _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode<=4)}", Range(0, 1)) = 1
+ _LightingIgnoreAmbientColor ("Ignore Ambient Color--{condition_showS:(_LightingMode<=3)}", Range(0, 1)) = 0
+
+ // Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0,1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Outlines
+ [HideInInspector] m_OutlineCategory (" Outlines--{reference_property:_EnableOutlines}", Float) = 0
+ // Outline Vertex
+ [HideInInspector][ToggleUI]_EnableOutlines ("Enable Outlines", float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ [Enum(Local, 0, World, 1)]_OutlineSpace ("Space", Int) = 0
+ _OutlineTintMix ("Tint Mix--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==1}}", Range(0, 1)) = 0
+ _OutlineRimLightBlend ("Rim Light Blend--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==2}}", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==3}}", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==4}}", Vector) = (1, 0, 0, 0)
+ [ToggleUI]_OutlineFixedSize ("Fixed Size?", Float) = 0
+ _OutlinesMaxDistance ("Fixed Size Max Distance", Float) = 9999
+ [Enum(Off, 0, Normals, 1, Mask VC.r, 2)]_OutlineUseVertexColors ("Vertex Color", Float) = 0
+ [ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color--{reference_property:_LineColorThemeIndex}", 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)] _LineColorThemeIndex ("", Int) = 0
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _OutlineTextureUV ("UV", Int) = 0
+ _OutlineMask ("Outline Mask--{reference_properties:[_OutlineMaskPan, _OutlineMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _OutlineMaskUV ("UV", Int) = 0
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+
+ [ThryToggleUI(true)]_OutlineHueShift ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _OutlineHueOffset ("Shift--{condition_showS:(_OutlineHueShift==1)}", Range(0, 1)) = 0
+ _OutlineHueOffsetSpeed ("Shift Speed--{condition_showS:(_OutlineHueShift==1)}", Float) = 0
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ [ToggleUI]_OutlineClipAtZeroWidth ("Clip 0 Width", Float) = 0
+ [ToggleUI]_OutlineOverrideAlpha ("Override Base Alpha", Float) = 0
+ _Offset_Z ("Cam Z Offset", Float) = 0
+ [Vector2]_OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineZTest ("ZTest", Float) = 4
+ _OutlineOffsetFactor ("Offset Factor", Float) = 0
+ _OutlineOffsetUnits ("Offset Units", Float) = 0
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Outline Stencil
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _OutlineStencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ // Outline Blending Options
+ [HideInInspector] m_start_outlineBlending ("Outline Blending", Float) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _OutlineSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _OutlineDstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_end_outlineBlending ("Outline Blending", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap.a, matcapMask * _MatcapAlphaOverride);
+
+ //UNITY_BRANCH
+ if (_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap2.a, matcap2Mask * _Matcap2AlphaOverride);
+
+ //UNITY_BRANCH
+ if (_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1,FresnelLerp(specCol, grazingTerm, poiLight.nDotV),_RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ ReadMask [_OutlineStencilReadMask]
+ WriteMask [_OutlineStencilWriteMask]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+
+ /*
+ ColorMask [_ColorMask]
+ Offset [_OutlineOffsetFactor], [_OutlineOffsetUnits]
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ AlphaToMask [_AlphaToCoverage]
+ Cull [_OutlineCull]
+ */
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_OutlineZTest]
+ Cull [_OutlineCull]
+ Blend [_OutlineSrcBlend] [_OutlineDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_OUTLINE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_PASS_OUTLINE
+ // outline Vertex Options
+ float _OutlineMode;
+ float4 _OutlinePersonaDirection;
+ float4 _OutlineDropShadowOffset;
+ float _OutlineUseVertexColors;
+ float _OutlineFixedSize;
+ float _EnableOutlines;
+ float _OutlinesMaxDistance;
+ float _LineWidth;
+ float _OutlineEmission;
+ float4 _LineColor;
+ float _OutlineOverrideAlpha;
+ float _OutlineSpace;
+ texture2D _OutlineTexture; //TODO make this dynamically not read for lock in
+ float4 _OutlineTexture_ST;
+ float2 _OutlineTexturePan;
+ float _OutlineTextureUV;
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+ sampler2D _OutlineMask;
+ float4 _OutlineMask_ST;
+ float2 _OutlineMaskPan;
+ float _OutlineMaskUV;
+ float _OutlineRimLightBlend;
+ float _OutlineLit;
+ float _OutlineTintMix;
+ half _OutlineHueOffset;
+ half _OutlineHueShift;
+ half _OutlineHueOffsetSpeed;
+ float _OutlineShadowStrength;
+ float _LineColorThemeIndex;
+ float _Offset_Z;
+ float _OutlineClipAtZeroWidth;
+ #endif
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_PASS_OUTLINE
+ void applyOutlineColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ clip(_EnableOutlines - 0.01);
+ float OutlineMask = tex2D(_OutlineMask, TRANSFORM_TEX(poiMesh.uv[_OutlineMaskUV], _OutlineMask) + _Time.x * _OutlineMaskPan).r;
+ if (_OutlineClipAtZeroWidth)
+ {
+ clip(OutlineMask * _LineWidth - 0.001);
+ }
+ float4 col = POI2D_SAMPLER_PAN(_OutlineTexture, _MainTex, poiUV(poiMesh.uv[_OutlineTextureUV], _OutlineTexture_ST), _OutlineTexturePan) * float4(poiThemeColor(poiMods, _LineColor.rgb, _LineColorThemeIndex), _LineColor.a);
+ //UNITY_BRANCH
+ if (_OutlineMode == 0)
+ {
+ poiFragData.baseColor = col;
+ }
+ //UNITY_BRANCH
+ if (_OutlineMode == 1)
+ {
+ poiFragData.baseColor = lerp(float4(poiThemeColor(poiMods, _LineColor.rgb, _LineColorThemeIndex), _LineColor.a), poiFragData.baseColor, _OutlineTintMix) * col;
+ }
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiLight.directColor, _OutlineRimLightBlend) * col;
+ }
+
+ if (_OutlineOverrideAlpha)
+ {
+ poiFragData.alpha = col.a;
+ }
+ else
+ {
+ poiFragData.alpha *= col.a;
+ }
+
+ // Hue shift
+ //UNITY_BRANCH
+ if (_OutlineHueShift)
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, _OutlineHueOffset +_OutlineHueOffsetSpeed * _Time.x);
+ }
+
+ poiFragData.emission += poiFragData.baseColor * _OutlineEmission;
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_PASS_OUTLINE
+ applyOutlineColor(poiFragData, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ /*
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ */
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap.a, matcapMask * _MatcapAlphaOverride);
+
+ //UNITY_BRANCH
+ if (_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap2.a, matcap2Mask * _Matcap2AlphaOverride);
+
+ //UNITY_BRANCH
+ if (_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1,FresnelLerp(specCol, grazingTerm, poiLight.nDotV),_RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Outline.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Outline.shader.meta
new file mode 100644
index 00000000..0a1b5f59
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi Outline.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: 9cdbe9241ea4aaa48944028272700834
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi World.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi World.shader
new file mode 100644
index 00000000..7b9c0231
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi World.shader
@@ -0,0 +1,28694 @@
+Shader ".poiyomi/Poiyomi 8.0/Poiyomi World"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.0.303</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:32},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:32},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:32},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:32},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:32},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [KeywordEnum(TextureRamp, Multilayer Math, Wrapped, Skin, ShadeMap, Flat, Realistic, Cloth)] _LightingMode ("Lighting Type", Float) = 5
+ _LightingShadowColor ("Shadow Tint--{condition_showS:(_LightingMode!=4 && _LightingMode!=1 && _LightingMode!=5)}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ /*
+ _SDFShadingTexture ("LUT--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ */
+ // Generic
+ _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode<=4)}", Range(0, 1)) = 1
+ _LightingIgnoreAmbientColor ("Ignore Ambient Color--{condition_showS:(_LightingMode<=3)}", Range(0, 1)) = 0
+
+ // Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ //_SpecularLMOcclusion ("Specular Occlusion", Range(0, 1)) = 0
+ //_SpecLMOcclusionAdjust ("Spec Occlusion Sensitiviy", Range(0, 1)) = 0.2
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0,1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ //Third party
+ [HideInInspector] m_thirdpartyCategory ("Third Party", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap.a, matcapMask * _MatcapAlphaOverride);
+
+ //UNITY_BRANCH
+ if (_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap2.a, matcap2Mask * _Matcap2AlphaOverride);
+
+ //UNITY_BRANCH
+ if (_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1,FresnelLerp(specCol, grazingTerm, poiLight.nDotV),_RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap.a, matcapMask * _MatcapAlphaOverride);
+
+ //UNITY_BRANCH
+ if (_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap2.a, matcap2Mask * _Matcap2AlphaOverride);
+
+ //UNITY_BRANCH
+ if (_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1,FresnelLerp(specCol, grazingTerm, poiLight.nDotV),_RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ //#pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_META
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _GIEmissionMultiplier;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #if defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ #ifdef POI_PASS_META
+ UnityMetaInput meta;
+ UNITY_INITIALIZE_OUTPUT(UnityMetaInput, meta);
+ meta.Emission = poiFragData.emission * _GIEmissionMultiplier * poiMods.globalEmission;
+ meta.Albedo = saturate(poiFragData.finalColor.rgb);
+ meta.SpecularColor = poiLight.finalLightAdd;
+ return UnityMetaFragment(meta);
+ #endif
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi World.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi World.shader.meta
new file mode 100644
index 00000000..0db44d6a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi World.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: c933bce24d9d90747a5def016febd042
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi.shader
new file mode 100644
index 00000000..c43bf313
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi.shader
@@ -0,0 +1,22881 @@
+Shader ".poiyomi/Poiyomi 8.0/Poiyomi Toon"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.0.303</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:32},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:32},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:32},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:32},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:32},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [KeywordEnum(TextureRamp, Multilayer Math, Wrapped, Skin, ShadeMap, Flat, Realistic, Cloth)] _LightingMode ("Lighting Type", Float) = 5
+ _LightingShadowColor ("Shadow Tint--{condition_showS:(_LightingMode!=4 && _LightingMode!=1 && _LightingMode!=5)}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ /*
+ _SDFShadingTexture ("LUT--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ */
+ // Generic
+ _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode<=4)}", Range(0, 1)) = 1
+ _LightingIgnoreAmbientColor ("Ignore Ambient Color--{condition_showS:(_LightingMode<=3)}", Range(0, 1)) = 0
+
+ // Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0,1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ //Third party
+ [HideInInspector] m_thirdpartyCategory ("Third Party", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap.a, matcapMask * _MatcapAlphaOverride);
+
+ //UNITY_BRANCH
+ if (_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap2.a, matcap2Mask * _Matcap2AlphaOverride);
+
+ //UNITY_BRANCH
+ if (_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1,FresnelLerp(specCol, grazingTerm, poiLight.nDotV),_RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #else
+ matcapMask = 1;
+ #endif
+
+ if (_MatcapMaskInvert)
+ {
+ matcapMask = 1 - matcapMask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap.a, matcapMask * _MatcapAlphaOverride);
+
+ //UNITY_BRANCH
+ if (_MatcapHueShiftEnabled)
+ {
+ matcap.rgb = hueShift(matcap.rgb, _MatcapHueShift + _Time.x * _MatcapHueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ poiFragData.alpha *= lerp(1, matcap2.a, matcap2Mask * _Matcap2AlphaOverride);
+
+ //UNITY_BRANCH
+ if (_Matcap2HueShiftEnabled)
+ {
+ matcap2.rgb = hueShift(matcap2.rgb, _Matcap2HueShift + _Time.x * _Matcap2HueShiftSpeed);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1,FresnelLerp(specCol, grazingTerm, poiLight.nDotV),_RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi.shader.meta
new file mode 100644
index 00000000..7d0e0517
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.0/Poiyomi.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: 231d95ff7213dd74f82af136b256fb32
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1.meta
new file mode 100755
index 00000000..fa2f5348
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: deacda933247faf4e827b2536aa28b51
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro.meta
new file mode 100755
index 00000000..029a881f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 38124deda9249eb45a06a631165bae8d
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Outline.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Outline.shader
new file mode 100644
index 00000000..fa9d9721
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Outline.shader
@@ -0,0 +1,29494 @@
+Shader ".poiyomi/Poiyomi 8.1/Poiyomi Pro Outline Early"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.1.052</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:16},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:16},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:16},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:16},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:16},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ [ThryToggleUI(true)] _DecalTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _Decal0TPSMaskStrength ("Mask r Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal1TPSMaskStrength ("Mask g Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal2TPSMaskStrength ("Mask b Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal3TPSMaskStrength ("Mask a Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_tps_penetrator ("Penetrator--{reference_property:_TPSPenetratorEnabled,tooltip:Enable TPS Penetrator: Requires the TPS Setup Wizard to be run (under Poi/TPS)}", Float) = 0
+ [HideInInspector] m_start_pen_autoConfig ("Configured By Tool", Float) = 0
+ _TPS_PenetratorLength ("Length of Penetrator Model--{tooltip:The length from the root of the P to the very tip}", Float) = 1
+ [Vector3]_TPS_PenetratorScale ("Scale of Penetrator Model", Vector) = (1, 1, 1, 1)
+ [Vector3]_TPS_PenetratorRight ("Right Vector", Vector) = (1, 0, 0, 0)
+ [Vector3]_TPS_PenetratorUp ("Up Vector", Vector) = (0, 1, 0, 0)
+ [Vector3]_TPS_PenetratorForward ("Forward Vector", Vector) = (0, 0, 1, 0)
+ [Toggle(TPS_ISSKINNEDMESH)]_TPS_IsSkinnedMeshRenderer ("Baked Vertex Colors", Float) = 0
+ [HideInInspector] m_end_pen_autoConfig ("TPS", Float) = 0
+ [Helpbox(1)]_TPSHelpbox ("Penetrator allows your mesh to bend in the direction of an orifice. It is fully compatible with DPS. Requires the TPS Setup Wizard to be run afterwards. Click here to open the setup window.--{onClick:Thry.TPS.TPS_Setup}", Float) = 0
+ [HideInInspector][ThryToggle(TPS_PENETRATOR)]_TPSPenetratorEnabled ("Enabled", Float) = 0
+ [Space(10)]
+ [ThryRichLabel(13)]_TPSBezierHeader ("Bezier--{tooltip: Changes how the penetrator bends}", Float) = 0
+ _TPS_BezierStart ("Bezier Start--{tooltip:Start later down the penetrator}", Range(0, 0.3)) = 0.0
+ _TPS_BezierSmoothness ("Bezier Smoothness--{tooltip:Smoothness of bending}", Range(0.2, 0.05)) = 0.09
+ [ThryRichLabel(13)]_TPSSqueezeHeader ("Squeeze--{tooltip:Penetrator contracts when entering an orifice}", Float) = 0
+ _TPS_Squeeze ("Squeeze Strength--{tooltip:Percentage penetrator squeezes}", Range(0, 1)) = 0.3
+ _TPS_SqueezeDistance ("Squeeze Distance--{tooltip:Width of the squeezing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSBuldgeHeader ("Buldge--{tooltip: Penetrator expands in front of the orifice}", Float) = 0
+ _TPS_Buldge ("Buldge--{tooltip:Amount in percentage}", Range(0, 3)) = 0.3
+ _TPS_BuldgeDistance ("Buldge Distance--{tooltip:Width of the buldging}", Range(0.01, 1)) = 0.2
+ _TPS_BuldgeFalloffDistance ("Buldge Falloff--{tooltip:Width of bulding in front of orifice}", Range(0.01, 0.5)) = 0.05
+ [ThryRichLabel(13)]_TPSPulsingHeader ("Pulsing--{tooltip: Penetrator expands in pulses while entering orifice}", Float) = 0
+ _TPS_PumpingStrength ("Pumping Strength--{tooltip:Amount in percentage}", Range(0, 1)) = 0
+ _TPS_PumpingSpeed ("Pumping Speed--{tooltip:Frequenzy of pulsing}", Range(0, 10)) = 0
+ _TPS_PumpingWidth ("Pumping Width--{tooltip:Width of pulsing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSIdleHeader ("Idle--{tooltip: Changes how the penetrator bends while no orifice is near}", Float) = 0
+ [Helpbox(0)]_TPS_IdleGravity ("Tip: For idle gravity & movement use physbones gravity & other functions", Float) = 0
+ _TPS_IdleSkrinkWidth ("Idle Shrink Width--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ _TPS_IdleSkrinkLength ("Idle Shrink Length--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ //Hide These, animated only
+ [HideInInspector]_TPS_BufferedDepth ("_TPS2_BufferedDepth NL", Float) = 0
+ [HideInInspector]_TPS_BufferedStrength ("_TPS2_BufferedStrength NL", Float) = 0
+ [HideInInspector] m_end_tps_penetrator ("", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [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)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ _SDFShadingTexture ("SDF--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ _SDFBlur ("Blur--{condition_showS:(_LightingMode==8)}", Range(0, 1)) = 0.1
+ [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)
+
+ // 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)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _MatcapTPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _MatcapTPSMaskStrength ("TPS Mask Strength--{condition_showS:(_MatcapTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _Matcap2TPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _Matcap2TPSMaskStrength ("TPS Mask Strength--{condition_showS:(_Matcap2TPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBrightness ("Brightness--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_depthRimLightOptions ("Depth Rim Lighting--{reference_property:_EnableDepthRimLighting}", 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
+ _DepthRimWidth ("Width", Range(0, 1)) = .2
+ _DepthRimSharpness ("Depth", Range(0, 1)) = .2
+ [ToggleUI]_DepthRimHideInShadow ("Hide In Shadow", Float) = 0
+
+ [Space][ThryHeaderLabel(Color and Blending, 13)]
+ _DepthRimMixBaseColor ("Use Base Color", Range(0, 1)) = 0
+ _DepthRimMixLightColor ("Light Color Mix", Range(0, 1)) = 0
+ _DepthRimColor ("Rim Color--{reference_property:_DepthRimColorThemeIndex}", Color) = (1, 1, 1, 1)
+ _DepthRimBrightness ("Color Brightness", Range(0, 10)) = 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)] _DepthRimColorThemeIndex ("", Int) = 0
+ _DepthRimEmission ("Emission", Range(0, 20)) = 0
+ _DepthRimReplace ("Replace", Range(0, 1)) = 0
+ _DepthRimAdd ("Add", Range(0, 1)) = 0
+ _DepthRimMultiply ("Multiply", Range(0, 1)) = 0
+ _DepthRimAdditiveLighting ("Add to Light", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthRimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ThryToggleUI(true)] _BRDFTPSDepthEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _BRDFTPSReflectionMaskStrength ("Reflection Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ _BRDFTPSSpecularMaskStrength ("Specular Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0, 1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ [ThryToggleUI(true)] _ClearCoatTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _ClearCoatTPSMaskStrength ("Mask Strength--{condition_showS:(_ClearCoatTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Outlines
+ [HideInInspector] m_OutlineCategory (" Outlines--{reference_property:_EnableOutlines}", Float) = 0
+ // Outline Vertex
+ [HideInInspector][ToggleUI]_EnableOutlines ("Enable Outlines", float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ [Enum(Local, 0, World, 1)]_OutlineSpace ("Space", Int) = 0
+ _OutlineTintMix ("Tint Mix--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==1}}", Range(0, 1)) = 0
+ _OutlineRimLightBlend ("Rim Light Blend--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==2}}", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==3}}", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==4}}", Vector) = (1, 0, 0, 0)
+ [ToggleUI]_OutlineFixedSize ("Fixed Size?", Float) = 0
+ _OutlinesMaxDistance ("Fixed Size Max Distance", Float) = 9999
+ [Enum(Off, 0, Normals, 1, Mask VC.r, 2)]_OutlineUseVertexColors ("Vertex Color", Float) = 0
+ [ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color--{reference_property:_LineColorThemeIndex}", 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)] _LineColorThemeIndex ("", Int) = 0
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _OutlineTextureUV ("UV", Int) = 0
+ _OutlineMask ("Outline Mask--{reference_properties:[_OutlineMaskPan, _OutlineMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _OutlineMaskUV ("UV", Int) = 0
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+
+ [ThryToggleUI(true)]_OutlineHueShift ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _OutlineHueOffset ("Shift--{condition_showS:(_OutlineHueShift==1)}", Range(0, 1)) = 0
+ _OutlineHueOffsetSpeed ("Shift Speed--{condition_showS:(_OutlineHueShift==1)}", Float) = 0
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ [ToggleUI]_OutlineClipAtZeroWidth ("Clip 0 Width", Float) = 0
+ [ToggleUI]_OutlineOverrideAlpha ("Override Base Alpha", Float) = 0
+ _Offset_Z ("Cam Z Offset", Float) = 0
+ //[Vector2]_OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineZTest ("ZTest", Float) = 4
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Outline Stencil
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _OutlineStencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ // Outline Blending Options
+ [HideInInspector] m_start_outlineBlending ("Outline Blending", Float) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _OutlineSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _OutlineDstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_end_outlineBlending ("Outline Blending", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ ReadMask [_OutlineStencilReadMask]
+ WriteMask [_OutlineStencilWriteMask]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+
+ /*
+ ColorMask [_ColorMask]
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ AlphaToMask [_AlphaToCoverage]
+ Cull [_OutlineCull]
+ */
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_OutlineZTest]
+ Cull [_OutlineCull]
+ Blend [_OutlineSrcBlend] [_OutlineDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_OUTLINE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_PASS_OUTLINE
+ // outline Vertex Options
+ float _OutlineMode;
+ float4 _OutlinePersonaDirection;
+ float4 _OutlineDropShadowOffset;
+ float _OutlineUseVertexColors;
+ float _OutlineFixedSize;
+ float _EnableOutlines;
+ float _OutlinesMaxDistance;
+ float _LineWidth;
+ float _OutlineEmission;
+ float4 _LineColor;
+ float _OutlineOverrideAlpha;
+ float _OutlineSpace;
+ texture2D _OutlineTexture; //TODO make this dynamically not read for lock in
+ float4 _OutlineTexture_ST;
+ float2 _OutlineTexturePan;
+ float _OutlineTextureUV;
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+ sampler2D _OutlineMask;
+ float4 _OutlineMask_ST;
+ float2 _OutlineMaskPan;
+ float _OutlineMaskUV;
+ float _OutlineRimLightBlend;
+ float _OutlineLit;
+ float _OutlineTintMix;
+ half _OutlineHueOffset;
+ half _OutlineHueShift;
+ half _OutlineHueOffsetSpeed;
+ float _OutlineShadowStrength;
+ float _LineColorThemeIndex;
+ float _Offset_Z;
+ float _OutlineClipAtZeroWidth;
+ #endif
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_PASS_OUTLINE
+ void applyOutlineColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ clip(_EnableOutlines - 0.01);
+ float OutlineMask = tex2D(_OutlineMask, TRANSFORM_TEX(poiMesh.uv[_OutlineMaskUV], _OutlineMask) + _Time.x * _OutlineMaskPan).r;
+ if (_OutlineClipAtZeroWidth)
+ {
+ clip(OutlineMask * _LineWidth - 0.001);
+ }
+ float4 col = POI2D_SAMPLER_PAN(_OutlineTexture, _MainTex, poiUV(poiMesh.uv[_OutlineTextureUV], _OutlineTexture_ST), _OutlineTexturePan) * float4(poiThemeColor(poiMods, _LineColor.rgb, _LineColorThemeIndex), _LineColor.a);
+ //UNITY_BRANCH
+ if (_OutlineMode == 0)
+ {
+ poiFragData.baseColor = col;
+ }
+ //UNITY_BRANCH
+ if (_OutlineMode == 1)
+ {
+ poiFragData.baseColor = lerp(float4(poiThemeColor(poiMods, _LineColor.rgb, _LineColorThemeIndex), _LineColor.a), poiFragData.baseColor, _OutlineTintMix) * col;
+ }
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiLight.directColor, _OutlineRimLightBlend) * col;
+ }
+
+ if (_OutlineOverrideAlpha)
+ {
+ poiFragData.alpha = col.a;
+ }
+ else
+ {
+ poiFragData.alpha *= col.a;
+ }
+
+ // Hue shift
+ //UNITY_BRANCH
+ if (_OutlineHueShift)
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, _OutlineHueOffset +_OutlineHueOffsetSpeed * _Time.x);
+ }
+
+ poiFragData.emission += poiFragData.baseColor * _OutlineEmission;
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_PASS_OUTLINE
+ applyOutlineColor(poiFragData, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ /*
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ */
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Outline.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Outline.shader.meta
new file mode 100755
index 00000000..6707018c
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Outline.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: 4bbe3bcd30e9d2849ace5825f0cb80de
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Z.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Z.shader
new file mode 100644
index 00000000..e152c75e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Z.shader
@@ -0,0 +1,24601 @@
+Shader ".poiyomi/Poiyomi 8.1/Poiyomi Pro Early Z"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.1.052</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:16},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:16},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:16},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:16},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:16},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ [ThryToggleUI(true)] _DecalTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _Decal0TPSMaskStrength ("Mask r Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal1TPSMaskStrength ("Mask g Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal2TPSMaskStrength ("Mask b Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal3TPSMaskStrength ("Mask a Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_tps_penetrator ("Penetrator--{reference_property:_TPSPenetratorEnabled,tooltip:Enable TPS Penetrator: Requires the TPS Setup Wizard to be run (under Poi/TPS)}", Float) = 0
+ [HideInInspector] m_start_pen_autoConfig ("Configured By Tool", Float) = 0
+ _TPS_PenetratorLength ("Length of Penetrator Model--{tooltip:The length from the root of the P to the very tip}", Float) = 1
+ [Vector3]_TPS_PenetratorScale ("Scale of Penetrator Model", Vector) = (1, 1, 1, 1)
+ [Vector3]_TPS_PenetratorRight ("Right Vector", Vector) = (1, 0, 0, 0)
+ [Vector3]_TPS_PenetratorUp ("Up Vector", Vector) = (0, 1, 0, 0)
+ [Vector3]_TPS_PenetratorForward ("Forward Vector", Vector) = (0, 0, 1, 0)
+ [Toggle(TPS_ISSKINNEDMESH)]_TPS_IsSkinnedMeshRenderer ("Baked Vertex Colors", Float) = 0
+ [HideInInspector] m_end_pen_autoConfig ("TPS", Float) = 0
+ [Helpbox(1)]_TPSHelpbox ("Penetrator allows your mesh to bend in the direction of an orifice. It is fully compatible with DPS. Requires the TPS Setup Wizard to be run afterwards. Click here to open the setup window.--{onClick:Thry.TPS.TPS_Setup}", Float) = 0
+ [HideInInspector][ThryToggle(TPS_PENETRATOR)]_TPSPenetratorEnabled ("Enabled", Float) = 0
+ [Space(10)]
+ [ThryRichLabel(13)]_TPSBezierHeader ("Bezier--{tooltip: Changes how the penetrator bends}", Float) = 0
+ _TPS_BezierStart ("Bezier Start--{tooltip:Start later down the penetrator}", Range(0, 0.3)) = 0.0
+ _TPS_BezierSmoothness ("Bezier Smoothness--{tooltip:Smoothness of bending}", Range(0.2, 0.05)) = 0.09
+ [ThryRichLabel(13)]_TPSSqueezeHeader ("Squeeze--{tooltip:Penetrator contracts when entering an orifice}", Float) = 0
+ _TPS_Squeeze ("Squeeze Strength--{tooltip:Percentage penetrator squeezes}", Range(0, 1)) = 0.3
+ _TPS_SqueezeDistance ("Squeeze Distance--{tooltip:Width of the squeezing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSBuldgeHeader ("Buldge--{tooltip: Penetrator expands in front of the orifice}", Float) = 0
+ _TPS_Buldge ("Buldge--{tooltip:Amount in percentage}", Range(0, 3)) = 0.3
+ _TPS_BuldgeDistance ("Buldge Distance--{tooltip:Width of the buldging}", Range(0.01, 1)) = 0.2
+ _TPS_BuldgeFalloffDistance ("Buldge Falloff--{tooltip:Width of bulding in front of orifice}", Range(0.01, 0.5)) = 0.05
+ [ThryRichLabel(13)]_TPSPulsingHeader ("Pulsing--{tooltip: Penetrator expands in pulses while entering orifice}", Float) = 0
+ _TPS_PumpingStrength ("Pumping Strength--{tooltip:Amount in percentage}", Range(0, 1)) = 0
+ _TPS_PumpingSpeed ("Pumping Speed--{tooltip:Frequenzy of pulsing}", Range(0, 10)) = 0
+ _TPS_PumpingWidth ("Pumping Width--{tooltip:Width of pulsing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSIdleHeader ("Idle--{tooltip: Changes how the penetrator bends while no orifice is near}", Float) = 0
+ [Helpbox(0)]_TPS_IdleGravity ("Tip: For idle gravity & movement use physbones gravity & other functions", Float) = 0
+ _TPS_IdleSkrinkWidth ("Idle Shrink Width--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ _TPS_IdleSkrinkLength ("Idle Shrink Length--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ //Hide These, animated only
+ [HideInInspector]_TPS_BufferedDepth ("_TPS2_BufferedDepth NL", Float) = 0
+ [HideInInspector]_TPS_BufferedStrength ("_TPS2_BufferedStrength NL", Float) = 0
+ [HideInInspector] m_end_tps_penetrator ("", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [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)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ _SDFShadingTexture ("SDF--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ _SDFBlur ("Blur--{condition_showS:(_LightingMode==8)}", Range(0, 1)) = 0.1
+ [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)
+
+ // 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)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _MatcapTPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _MatcapTPSMaskStrength ("TPS Mask Strength--{condition_showS:(_MatcapTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _Matcap2TPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _Matcap2TPSMaskStrength ("TPS Mask Strength--{condition_showS:(_Matcap2TPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBrightness ("Brightness--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_depthRimLightOptions ("Depth Rim Lighting--{reference_property:_EnableDepthRimLighting}", 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
+ _DepthRimWidth ("Width", Range(0, 1)) = .2
+ _DepthRimSharpness ("Depth", Range(0, 1)) = .2
+ [ToggleUI]_DepthRimHideInShadow ("Hide In Shadow", Float) = 0
+
+ [Space][ThryHeaderLabel(Color and Blending, 13)]
+ _DepthRimMixBaseColor ("Use Base Color", Range(0, 1)) = 0
+ _DepthRimMixLightColor ("Light Color Mix", Range(0, 1)) = 0
+ _DepthRimColor ("Rim Color--{reference_property:_DepthRimColorThemeIndex}", Color) = (1, 1, 1, 1)
+ _DepthRimBrightness ("Color Brightness", Range(0, 10)) = 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)] _DepthRimColorThemeIndex ("", Int) = 0
+ _DepthRimEmission ("Emission", Range(0, 20)) = 0
+ _DepthRimReplace ("Replace", Range(0, 1)) = 0
+ _DepthRimAdd ("Add", Range(0, 1)) = 0
+ _DepthRimMultiply ("Multiply", Range(0, 1)) = 0
+ _DepthRimAdditiveLighting ("Add to Light", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthRimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ThryToggleUI(true)] _BRDFTPSDepthEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _BRDFTPSReflectionMaskStrength ("Reflection Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ _BRDFTPSSpecularMaskStrength ("Specular Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0, 1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ [ThryToggleUI(true)] _ClearCoatTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _ClearCoatTPSMaskStrength ("Mask Strength--{condition_showS:(_ClearCoatTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ //Third party
+ [HideInInspector] m_thirdpartyCategory ("Third Party", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ ZWrite On
+ Cull [_Cull]
+ ColorMask 0
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #define POI_PASS_EARLYZ
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ 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);
+ }
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ UNITY_SETUP_INSTANCE_ID(i);
+ UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
+ return float4(1,1,1,1);
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Z.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Z.shader.meta
new file mode 100755
index 00000000..6b02f3ea
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Early Z.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: b884419d962809b4681455001cfe5e86
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Grab Pass.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Grab Pass.shader
new file mode 100644
index 00000000..88c90249
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Grab Pass.shader
@@ -0,0 +1,24437 @@
+Shader ".poiyomi/Poiyomi 8.1/Poiyomi Pro Grab Pass"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.1.052</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:16},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:16},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:16},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:16},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:16},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ [ThryToggleUI(true)] _DecalTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _Decal0TPSMaskStrength ("Mask r Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal1TPSMaskStrength ("Mask g Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal2TPSMaskStrength ("Mask b Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal3TPSMaskStrength ("Mask a Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_tps_penetrator ("Penetrator--{reference_property:_TPSPenetratorEnabled,tooltip:Enable TPS Penetrator: Requires the TPS Setup Wizard to be run (under Poi/TPS)}", Float) = 0
+ [HideInInspector] m_start_pen_autoConfig ("Configured By Tool", Float) = 0
+ _TPS_PenetratorLength ("Length of Penetrator Model--{tooltip:The length from the root of the P to the very tip}", Float) = 1
+ [Vector3]_TPS_PenetratorScale ("Scale of Penetrator Model", Vector) = (1, 1, 1, 1)
+ [Vector3]_TPS_PenetratorRight ("Right Vector", Vector) = (1, 0, 0, 0)
+ [Vector3]_TPS_PenetratorUp ("Up Vector", Vector) = (0, 1, 0, 0)
+ [Vector3]_TPS_PenetratorForward ("Forward Vector", Vector) = (0, 0, 1, 0)
+ [Toggle(TPS_ISSKINNEDMESH)]_TPS_IsSkinnedMeshRenderer ("Baked Vertex Colors", Float) = 0
+ [HideInInspector] m_end_pen_autoConfig ("TPS", Float) = 0
+ [Helpbox(1)]_TPSHelpbox ("Penetrator allows your mesh to bend in the direction of an orifice. It is fully compatible with DPS. Requires the TPS Setup Wizard to be run afterwards. Click here to open the setup window.--{onClick:Thry.TPS.TPS_Setup}", Float) = 0
+ [HideInInspector][ThryToggle(TPS_PENETRATOR)]_TPSPenetratorEnabled ("Enabled", Float) = 0
+ [Space(10)]
+ [ThryRichLabel(13)]_TPSBezierHeader ("Bezier--{tooltip: Changes how the penetrator bends}", Float) = 0
+ _TPS_BezierStart ("Bezier Start--{tooltip:Start later down the penetrator}", Range(0, 0.3)) = 0.0
+ _TPS_BezierSmoothness ("Bezier Smoothness--{tooltip:Smoothness of bending}", Range(0.2, 0.05)) = 0.09
+ [ThryRichLabel(13)]_TPSSqueezeHeader ("Squeeze--{tooltip:Penetrator contracts when entering an orifice}", Float) = 0
+ _TPS_Squeeze ("Squeeze Strength--{tooltip:Percentage penetrator squeezes}", Range(0, 1)) = 0.3
+ _TPS_SqueezeDistance ("Squeeze Distance--{tooltip:Width of the squeezing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSBuldgeHeader ("Buldge--{tooltip: Penetrator expands in front of the orifice}", Float) = 0
+ _TPS_Buldge ("Buldge--{tooltip:Amount in percentage}", Range(0, 3)) = 0.3
+ _TPS_BuldgeDistance ("Buldge Distance--{tooltip:Width of the buldging}", Range(0.01, 1)) = 0.2
+ _TPS_BuldgeFalloffDistance ("Buldge Falloff--{tooltip:Width of bulding in front of orifice}", Range(0.01, 0.5)) = 0.05
+ [ThryRichLabel(13)]_TPSPulsingHeader ("Pulsing--{tooltip: Penetrator expands in pulses while entering orifice}", Float) = 0
+ _TPS_PumpingStrength ("Pumping Strength--{tooltip:Amount in percentage}", Range(0, 1)) = 0
+ _TPS_PumpingSpeed ("Pumping Speed--{tooltip:Frequenzy of pulsing}", Range(0, 10)) = 0
+ _TPS_PumpingWidth ("Pumping Width--{tooltip:Width of pulsing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSIdleHeader ("Idle--{tooltip: Changes how the penetrator bends while no orifice is near}", Float) = 0
+ [Helpbox(0)]_TPS_IdleGravity ("Tip: For idle gravity & movement use physbones gravity & other functions", Float) = 0
+ _TPS_IdleSkrinkWidth ("Idle Shrink Width--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ _TPS_IdleSkrinkLength ("Idle Shrink Length--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ //Hide These, animated only
+ [HideInInspector]_TPS_BufferedDepth ("_TPS2_BufferedDepth NL", Float) = 0
+ [HideInInspector]_TPS_BufferedStrength ("_TPS2_BufferedStrength NL", Float) = 0
+ [HideInInspector] m_end_tps_penetrator ("", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [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)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ _SDFShadingTexture ("SDF--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ _SDFBlur ("Blur--{condition_showS:(_LightingMode==8)}", Range(0, 1)) = 0.1
+ [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)
+
+ // 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)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _MatcapTPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _MatcapTPSMaskStrength ("TPS Mask Strength--{condition_showS:(_MatcapTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _Matcap2TPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _Matcap2TPSMaskStrength ("TPS Mask Strength--{condition_showS:(_Matcap2TPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBrightness ("Brightness--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_depthRimLightOptions ("Depth Rim Lighting--{reference_property:_EnableDepthRimLighting}", 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
+ _DepthRimWidth ("Width", Range(0, 1)) = .2
+ _DepthRimSharpness ("Depth", Range(0, 1)) = .2
+ [ToggleUI]_DepthRimHideInShadow ("Hide In Shadow", Float) = 0
+
+ [Space][ThryHeaderLabel(Color and Blending, 13)]
+ _DepthRimMixBaseColor ("Use Base Color", Range(0, 1)) = 0
+ _DepthRimMixLightColor ("Light Color Mix", Range(0, 1)) = 0
+ _DepthRimColor ("Rim Color--{reference_property:_DepthRimColorThemeIndex}", Color) = (1, 1, 1, 1)
+ _DepthRimBrightness ("Color Brightness", Range(0, 10)) = 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)] _DepthRimColorThemeIndex ("", Int) = 0
+ _DepthRimEmission ("Emission", Range(0, 20)) = 0
+ _DepthRimReplace ("Replace", Range(0, 1)) = 0
+ _DepthRimAdd ("Add", Range(0, 1)) = 0
+ _DepthRimMultiply ("Multiply", Range(0, 1)) = 0
+ _DepthRimAdditiveLighting ("Add to Light", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthRimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ThryToggleUI(true)] _BRDFTPSDepthEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _BRDFTPSReflectionMaskStrength ("Reflection Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ _BRDFTPSSpecularMaskStrength ("Specular Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0, 1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ [ThryToggleUI(true)] _ClearCoatTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _ClearCoatTPSMaskStrength ("Mask Strength--{condition_showS:(_ClearCoatTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_grabPassCategory ("Grab Pass", Float) = 0
+ [HideInInspector] m_start_GrabPass ("GrabPass Transparency--{reference_property:_EnableGrabpass}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableGrabpass ("Enable GrabPass", Float) = 1
+ [ToggleUI]_GrabPassUseAlpha ("Use Alpha", Float) = 1
+ _GrabPassBlendMap ("Blend Map--{reference_properties:[_GrabPassBlendMapPan, _GrabPassBlendMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GrabPassBlendMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, distorteduv0, 4)] _GrabPassBlendMapUV ("UV", Int) = 0
+ _GrabPassBlendFactor ("Blend Amount", Range(0, 1)) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _GrabSrcBlend ("Source Blend", Int) = 2
+ [Enum(UnityEngine.Rendering.BlendMode)] _GrabDstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_start_Refraction ("Refraction--{reference_property:_RefractionEnabled}", Float) = 0
+ [ToggleUI] _RefractionEnabled ("Enable Refraction,", Float) = 0
+ _RefractionIndex ("Refraction", Range(0, 3)) = 1.333333
+ _RefractionChromaticAberattion ("Chromatic Aberration", Range(0, 1)) = 0
+ [HideInInspector] m_end_Refraction ("Refraction", Float) = 0
+ [HideInInspector] m_start_Blur ("Blur--{reference_property:_EnableBlur}", Float) = 0
+ [HideInInspector][ThryToggle(CHROMATIC_ABERRATION_LOW)]_EnableBlur ("Enable Blur", Float) = 0
+ _GrabBlurDistance ("Blur Distance", Range(0, 1)) = 0
+ [IntRange]_GrabBlurQuality ("Blur Quality", Range(1, 10)) = 2
+ [IntRange]_GrabBlurDirections ("Blur Directions", Range(1, 10)) = 4
+ [HideInInspector] m_end_Blur ("Blur", Float) = 0
+ [HideInInspector] m_end_GrabPass ("GrabPass Transparency", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ //EnableGrabpass
+ GrabPass
+ {
+ "_PoiGrab2"
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature CHROMATIC_ABERRATION_LOW
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_PoiGrab2); // Grabpass texture
+ float _RefractionIndex;
+ float _RefractionOpacity;
+ float _RefractionChromaticAberattion;
+ float _RefractionEnabled;
+ float _GrabSrcBlend;
+ float _GrabDstBlend;
+ float _GrabPassUseAlpha;
+ float _GrabPassBlendFactor;
+ float _GrabBlurDistance;
+ float _GrabBlurQuality;
+ float _GrabBlurDirections;
+ Texture2D _GrabPassBlendMap;
+ float4 _GrabPassBlendMap_ST;
+ float2 _GrabPassBlendMapPan;
+ float _GrabPassBlendMapUV;
+ float _EnableGrabpass;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ float4 blur(float2 uv)
+ {
+ float two_pi = 6.28318530718;
+
+ float2 radius = _GrabBlurDistance / _ScreenParams.xy * 100; // Arbitrary constant to match old blur
+ float quality = floor(_GrabBlurQuality);
+ float directions = floor(_GrabBlurDirections);
+
+ // Pixel colour
+ float4 color = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, uv);
+
+ float deltaAngle = two_pi / directions;
+ float deltaQuality = 1.0 / quality;
+ for (int i = 0; i < directions; i++)
+ {
+ for (int j = 0; j < quality; j++)
+ {
+ float angle = deltaAngle * i + j;
+ float offset = deltaQuality * (j + 1);
+ color += UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, uv + float2(cos(angle), sin(angle)) * radius * offset);
+ }
+ }
+
+ // Output to screen
+ color /= quality * directions + 1;
+ return color;
+ }
+
+ inline float4 Refraction(float indexOfRefraction, float chromaticAberration, float2 projectedGrabPos, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ float4 refractionColor;
+ float3 worldViewDir = normalize(UnityWorldSpaceViewDir(poiMesh.worldPos));
+ float3 refractionOffset = ((((indexOfRefraction - 1.0) * mul(UNITY_MATRIX_V, float4(poiMesh.normals[1], 0.0)).xyz) * (1.0 / (poiCam.grabPos.z + 1.0))) * (1.0 - dot(poiMesh.normals[1], worldViewDir)));
+ float2 cameraRefraction = float2(refractionOffset.x, - (refractionOffset.y * _ProjectionParams.x));
+
+ UNITY_BRANCH
+ if (_RefractionChromaticAberattion > 0)
+ {
+ float4 redAlpha = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, (projectedGrabPos + cameraRefraction));
+ float green = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, (projectedGrabPos + (cameraRefraction * (1.0 - chromaticAberration)))).g;
+ float blue = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, (projectedGrabPos + (cameraRefraction * (1.0 + chromaticAberration)))).b;
+ refractionColor = float4(redAlpha.r, green, blue, redAlpha.a);
+ }
+ else
+ {
+ float2 refractedGrab = projectedGrabPos + cameraRefraction;
+
+ #ifdef CHROMATIC_ABERRATION_LOW
+ refractionColor = blur(refractedGrab);
+ #else
+ refractionColor = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, (refractedGrab));
+ #endif
+ }
+ return refractionColor;
+ }
+
+ void calculateRefraction(float2 projectedGrabPos, inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ float3 refraction = 1;
+ UNITY_BRANCH
+ if (_RefractionEnabled == 1)
+ {
+ refraction = Refraction(_RefractionIndex, _RefractionChromaticAberattion, projectedGrabPos, poiMesh, poiCam).rgb;
+ }
+ else
+ {
+ #ifdef CHROMATIC_ABERRATION_LOW
+ refraction = blur(projectedGrabPos);
+ #else
+ refraction = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, projectedGrabPos).rgb;
+ #endif
+ }
+
+ float blendTexture = POI2D_SAMPLER_PAN(_GrabPassBlendMap, _MainTex, poiUV(poiMesh.uv[_GrabPassBlendMapUV], _GrabPassBlendMap_ST), _GrabPassBlendMapPan).r;
+ float blendFactor = _GrabPassBlendFactor * blendTexture;
+
+ UNITY_BRANCH
+ if (_GrabPassUseAlpha)
+ {
+ #ifdef UNITY_PASS_FORWARDADD
+ poiLight.finalLighting *= max((1 - blendFactor), lerp(1, poiFragData.alpha, _GrabPassBlendFactor));
+ #else
+ poiLight.finalLighting = lerp(1, poiLight.finalLighting, max((1 - blendFactor), lerp(1, poiFragData.alpha, _GrabPassBlendFactor)));
+ #endif
+ poiFragData.finalColor = poiBlend(_GrabSrcBlend, float4(poiFragData.finalColor, poiFragData.alpha), _GrabDstBlend, float4(refraction, 1), blendFactor * (1 - poiFragData.alpha));
+ poiFragData.baseColor = poiFragData.finalColor;
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDADD
+ poiLight.finalLighting *= 1 - blendFactor;
+ #else
+ poiLight.finalLighting = lerp(1, poiLight.finalLighting, 1 - blendFactor);
+ #endif
+ poiFragData.finalColor = poiBlend(_GrabSrcBlend, float4(poiFragData.finalColor, poiFragData.alpha), _GrabDstBlend, float4(refraction, 1), blendFactor);
+ poiFragData.baseColor = poiFragData.finalColor;
+ }
+ }
+
+ inline float2 cmputeGrabScreenPos(in float4 pos)
+ {
+ float4 grabPos = pos;
+ #if UNITY_UV_STARTS_AT_TOP
+ float scale = -1.0;
+ #else
+ float scale = 1.0;
+ #endif
+ float halfPosW = grabPos.w * 0.5;
+ grabPos.y = (grabPos.y - halfPosW) * _ProjectionParams.x * scale + halfPosW;
+ #if SHADER_API_D3D9 || SHADER_API_D3D11
+ grabPos.w += 0.00000000001;
+ #endif
+ return(grabPos / grabPos.w).xy;
+ }
+
+ void applyGrabEffects(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ float2 projectedGrabPos = cmputeGrabScreenPos(poiCam.grabPos);
+ calculateRefraction(projectedGrabPos, poiFragData, poiCam, poiMesh, poiLight);
+ }
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ if (_EnableGrabpass)
+ {
+ applyGrabEffects(poiFragData, poiCam, poiMesh, poiLight);
+ poiFragData.alpha = 1;
+ }
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature CHROMATIC_ABERRATION_LOW
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_PoiGrab2); // Grabpass texture
+ float _RefractionIndex;
+ float _RefractionOpacity;
+ float _RefractionChromaticAberattion;
+ float _RefractionEnabled;
+ float _GrabSrcBlend;
+ float _GrabDstBlend;
+ float _GrabPassUseAlpha;
+ float _GrabPassBlendFactor;
+ float _GrabBlurDistance;
+ float _GrabBlurQuality;
+ float _GrabBlurDirections;
+ Texture2D _GrabPassBlendMap;
+ float4 _GrabPassBlendMap_ST;
+ float2 _GrabPassBlendMapPan;
+ float _GrabPassBlendMapUV;
+ float _EnableGrabpass;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ float4 blur(float2 uv)
+ {
+ float two_pi = 6.28318530718;
+
+ float2 radius = _GrabBlurDistance / _ScreenParams.xy * 100; // Arbitrary constant to match old blur
+ float quality = floor(_GrabBlurQuality);
+ float directions = floor(_GrabBlurDirections);
+
+ // Pixel colour
+ float4 color = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, uv);
+
+ float deltaAngle = two_pi / directions;
+ float deltaQuality = 1.0 / quality;
+ for (int i = 0; i < directions; i++)
+ {
+ for (int j = 0; j < quality; j++)
+ {
+ float angle = deltaAngle * i + j;
+ float offset = deltaQuality * (j + 1);
+ color += UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, uv + float2(cos(angle), sin(angle)) * radius * offset);
+ }
+ }
+
+ // Output to screen
+ color /= quality * directions + 1;
+ return color;
+ }
+
+ inline float4 Refraction(float indexOfRefraction, float chromaticAberration, float2 projectedGrabPos, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ float4 refractionColor;
+ float3 worldViewDir = normalize(UnityWorldSpaceViewDir(poiMesh.worldPos));
+ float3 refractionOffset = ((((indexOfRefraction - 1.0) * mul(UNITY_MATRIX_V, float4(poiMesh.normals[1], 0.0)).xyz) * (1.0 / (poiCam.grabPos.z + 1.0))) * (1.0 - dot(poiMesh.normals[1], worldViewDir)));
+ float2 cameraRefraction = float2(refractionOffset.x, - (refractionOffset.y * _ProjectionParams.x));
+
+ UNITY_BRANCH
+ if (_RefractionChromaticAberattion > 0)
+ {
+ float4 redAlpha = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, (projectedGrabPos + cameraRefraction));
+ float green = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, (projectedGrabPos + (cameraRefraction * (1.0 - chromaticAberration)))).g;
+ float blue = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, (projectedGrabPos + (cameraRefraction * (1.0 + chromaticAberration)))).b;
+ refractionColor = float4(redAlpha.r, green, blue, redAlpha.a);
+ }
+ else
+ {
+ float2 refractedGrab = projectedGrabPos + cameraRefraction;
+
+ #ifdef CHROMATIC_ABERRATION_LOW
+ refractionColor = blur(refractedGrab);
+ #else
+ refractionColor = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, (refractedGrab));
+ #endif
+ }
+ return refractionColor;
+ }
+
+ void calculateRefraction(float2 projectedGrabPos, inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ float3 refraction = 1;
+ UNITY_BRANCH
+ if (_RefractionEnabled == 1)
+ {
+ refraction = Refraction(_RefractionIndex, _RefractionChromaticAberattion, projectedGrabPos, poiMesh, poiCam).rgb;
+ }
+ else
+ {
+ #ifdef CHROMATIC_ABERRATION_LOW
+ refraction = blur(projectedGrabPos);
+ #else
+ refraction = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_PoiGrab2, projectedGrabPos).rgb;
+ #endif
+ }
+
+ float blendTexture = POI2D_SAMPLER_PAN(_GrabPassBlendMap, _MainTex, poiUV(poiMesh.uv[_GrabPassBlendMapUV], _GrabPassBlendMap_ST), _GrabPassBlendMapPan).r;
+ float blendFactor = _GrabPassBlendFactor * blendTexture;
+
+ UNITY_BRANCH
+ if (_GrabPassUseAlpha)
+ {
+ #ifdef UNITY_PASS_FORWARDADD
+ poiLight.finalLighting *= max((1 - blendFactor), lerp(1, poiFragData.alpha, _GrabPassBlendFactor));
+ #else
+ poiLight.finalLighting = lerp(1, poiLight.finalLighting, max((1 - blendFactor), lerp(1, poiFragData.alpha, _GrabPassBlendFactor)));
+ #endif
+ poiFragData.finalColor = poiBlend(_GrabSrcBlend, float4(poiFragData.finalColor, poiFragData.alpha), _GrabDstBlend, float4(refraction, 1), blendFactor * (1 - poiFragData.alpha));
+ poiFragData.baseColor = poiFragData.finalColor;
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDADD
+ poiLight.finalLighting *= 1 - blendFactor;
+ #else
+ poiLight.finalLighting = lerp(1, poiLight.finalLighting, 1 - blendFactor);
+ #endif
+ poiFragData.finalColor = poiBlend(_GrabSrcBlend, float4(poiFragData.finalColor, poiFragData.alpha), _GrabDstBlend, float4(refraction, 1), blendFactor);
+ poiFragData.baseColor = poiFragData.finalColor;
+ }
+ }
+
+ inline float2 cmputeGrabScreenPos(in float4 pos)
+ {
+ float4 grabPos = pos;
+ #if UNITY_UV_STARTS_AT_TOP
+ float scale = -1.0;
+ #else
+ float scale = 1.0;
+ #endif
+ float halfPosW = grabPos.w * 0.5;
+ grabPos.y = (grabPos.y - halfPosW) * _ProjectionParams.x * scale + halfPosW;
+ #if SHADER_API_D3D9 || SHADER_API_D3D11
+ grabPos.w += 0.00000000001;
+ #endif
+ return(grabPos / grabPos.w).xy;
+ }
+
+ void applyGrabEffects(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ float2 projectedGrabPos = cmputeGrabScreenPos(poiCam.grabPos);
+ calculateRefraction(projectedGrabPos, poiFragData, poiCam, poiMesh, poiLight);
+ }
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ if (_EnableGrabpass)
+ {
+ applyGrabEffects(poiFragData, poiCam, poiMesh, poiLight);
+ poiFragData.alpha = 1;
+ }
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature CHROMATIC_ABERRATION_LOW
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Grab Pass.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Grab Pass.shader.meta
new file mode 100755
index 00000000..64308236
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Grab Pass.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: 549710ad55e2f0143a729d524465e291
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Outline.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Outline.shader
new file mode 100644
index 00000000..d01bdb4a
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Outline.shader
@@ -0,0 +1,29494 @@
+Shader ".poiyomi/Poiyomi 8.1/Poiyomi Pro Outline"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.1.052</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:16},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:16},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:16},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:16},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:16},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ [ThryToggleUI(true)] _DecalTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _Decal0TPSMaskStrength ("Mask r Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal1TPSMaskStrength ("Mask g Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal2TPSMaskStrength ("Mask b Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal3TPSMaskStrength ("Mask a Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_tps_penetrator ("Penetrator--{reference_property:_TPSPenetratorEnabled,tooltip:Enable TPS Penetrator: Requires the TPS Setup Wizard to be run (under Poi/TPS)}", Float) = 0
+ [HideInInspector] m_start_pen_autoConfig ("Configured By Tool", Float) = 0
+ _TPS_PenetratorLength ("Length of Penetrator Model--{tooltip:The length from the root of the P to the very tip}", Float) = 1
+ [Vector3]_TPS_PenetratorScale ("Scale of Penetrator Model", Vector) = (1, 1, 1, 1)
+ [Vector3]_TPS_PenetratorRight ("Right Vector", Vector) = (1, 0, 0, 0)
+ [Vector3]_TPS_PenetratorUp ("Up Vector", Vector) = (0, 1, 0, 0)
+ [Vector3]_TPS_PenetratorForward ("Forward Vector", Vector) = (0, 0, 1, 0)
+ [Toggle(TPS_ISSKINNEDMESH)]_TPS_IsSkinnedMeshRenderer ("Baked Vertex Colors", Float) = 0
+ [HideInInspector] m_end_pen_autoConfig ("TPS", Float) = 0
+ [Helpbox(1)]_TPSHelpbox ("Penetrator allows your mesh to bend in the direction of an orifice. It is fully compatible with DPS. Requires the TPS Setup Wizard to be run afterwards. Click here to open the setup window.--{onClick:Thry.TPS.TPS_Setup}", Float) = 0
+ [HideInInspector][ThryToggle(TPS_PENETRATOR)]_TPSPenetratorEnabled ("Enabled", Float) = 0
+ [Space(10)]
+ [ThryRichLabel(13)]_TPSBezierHeader ("Bezier--{tooltip: Changes how the penetrator bends}", Float) = 0
+ _TPS_BezierStart ("Bezier Start--{tooltip:Start later down the penetrator}", Range(0, 0.3)) = 0.0
+ _TPS_BezierSmoothness ("Bezier Smoothness--{tooltip:Smoothness of bending}", Range(0.2, 0.05)) = 0.09
+ [ThryRichLabel(13)]_TPSSqueezeHeader ("Squeeze--{tooltip:Penetrator contracts when entering an orifice}", Float) = 0
+ _TPS_Squeeze ("Squeeze Strength--{tooltip:Percentage penetrator squeezes}", Range(0, 1)) = 0.3
+ _TPS_SqueezeDistance ("Squeeze Distance--{tooltip:Width of the squeezing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSBuldgeHeader ("Buldge--{tooltip: Penetrator expands in front of the orifice}", Float) = 0
+ _TPS_Buldge ("Buldge--{tooltip:Amount in percentage}", Range(0, 3)) = 0.3
+ _TPS_BuldgeDistance ("Buldge Distance--{tooltip:Width of the buldging}", Range(0.01, 1)) = 0.2
+ _TPS_BuldgeFalloffDistance ("Buldge Falloff--{tooltip:Width of bulding in front of orifice}", Range(0.01, 0.5)) = 0.05
+ [ThryRichLabel(13)]_TPSPulsingHeader ("Pulsing--{tooltip: Penetrator expands in pulses while entering orifice}", Float) = 0
+ _TPS_PumpingStrength ("Pumping Strength--{tooltip:Amount in percentage}", Range(0, 1)) = 0
+ _TPS_PumpingSpeed ("Pumping Speed--{tooltip:Frequenzy of pulsing}", Range(0, 10)) = 0
+ _TPS_PumpingWidth ("Pumping Width--{tooltip:Width of pulsing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSIdleHeader ("Idle--{tooltip: Changes how the penetrator bends while no orifice is near}", Float) = 0
+ [Helpbox(0)]_TPS_IdleGravity ("Tip: For idle gravity & movement use physbones gravity & other functions", Float) = 0
+ _TPS_IdleSkrinkWidth ("Idle Shrink Width--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ _TPS_IdleSkrinkLength ("Idle Shrink Length--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ //Hide These, animated only
+ [HideInInspector]_TPS_BufferedDepth ("_TPS2_BufferedDepth NL", Float) = 0
+ [HideInInspector]_TPS_BufferedStrength ("_TPS2_BufferedStrength NL", Float) = 0
+ [HideInInspector] m_end_tps_penetrator ("", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [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)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ _SDFShadingTexture ("SDF--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ _SDFBlur ("Blur--{condition_showS:(_LightingMode==8)}", Range(0, 1)) = 0.1
+ [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)
+
+ // 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)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _MatcapTPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _MatcapTPSMaskStrength ("TPS Mask Strength--{condition_showS:(_MatcapTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _Matcap2TPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _Matcap2TPSMaskStrength ("TPS Mask Strength--{condition_showS:(_Matcap2TPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBrightness ("Brightness--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_depthRimLightOptions ("Depth Rim Lighting--{reference_property:_EnableDepthRimLighting}", 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
+ _DepthRimWidth ("Width", Range(0, 1)) = .2
+ _DepthRimSharpness ("Depth", Range(0, 1)) = .2
+ [ToggleUI]_DepthRimHideInShadow ("Hide In Shadow", Float) = 0
+
+ [Space][ThryHeaderLabel(Color and Blending, 13)]
+ _DepthRimMixBaseColor ("Use Base Color", Range(0, 1)) = 0
+ _DepthRimMixLightColor ("Light Color Mix", Range(0, 1)) = 0
+ _DepthRimColor ("Rim Color--{reference_property:_DepthRimColorThemeIndex}", Color) = (1, 1, 1, 1)
+ _DepthRimBrightness ("Color Brightness", Range(0, 10)) = 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)] _DepthRimColorThemeIndex ("", Int) = 0
+ _DepthRimEmission ("Emission", Range(0, 20)) = 0
+ _DepthRimReplace ("Replace", Range(0, 1)) = 0
+ _DepthRimAdd ("Add", Range(0, 1)) = 0
+ _DepthRimMultiply ("Multiply", Range(0, 1)) = 0
+ _DepthRimAdditiveLighting ("Add to Light", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthRimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ThryToggleUI(true)] _BRDFTPSDepthEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _BRDFTPSReflectionMaskStrength ("Reflection Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ _BRDFTPSSpecularMaskStrength ("Specular Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0, 1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ [ThryToggleUI(true)] _ClearCoatTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _ClearCoatTPSMaskStrength ("Mask Strength--{condition_showS:(_ClearCoatTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Outlines
+ [HideInInspector] m_OutlineCategory (" Outlines--{reference_property:_EnableOutlines}", Float) = 0
+ // Outline Vertex
+ [HideInInspector][ToggleUI]_EnableOutlines ("Enable Outlines", float) = 0
+ [Enum(Basic, 0, Tint, 1, Rim Light, 2, Directional, 3, DropShadow, 4)]_OutlineMode ("Mode", Int) = 0
+ [Enum(Local, 0, World, 1)]_OutlineSpace ("Space", Int) = 0
+ _OutlineTintMix ("Tint Mix--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==1}}", Range(0, 1)) = 0
+ _OutlineRimLightBlend ("Rim Light Blend--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==2}}", Range(0, 1)) = 0
+ _OutlinePersonaDirection ("directional Offset XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==3}}", Vector) = (1, 0, 0, 0)
+ _OutlineDropShadowOffset ("Drop Direction XY--{condition_show:{type:PROPERTY_BOOL,data:_OutlineMode==4}}", Vector) = (1, 0, 0, 0)
+ [ToggleUI]_OutlineFixedSize ("Fixed Size?", Float) = 0
+ _OutlinesMaxDistance ("Fixed Size Max Distance", Float) = 9999
+ [Enum(Off, 0, Normals, 1, Mask VC.r, 2)]_OutlineUseVertexColors ("Vertex Color", Float) = 0
+ [ToggleUI]_OutlineLit ("Enable Lighting", Float) = 1
+ _LineWidth ("Width", Float) = 0
+ _LineColor ("Color--{reference_property:_LineColorThemeIndex}", 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)] _LineColorThemeIndex ("", Int) = 0
+ _OutlineEmission ("Outline Emission", Float) = 0
+ _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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _OutlineTextureUV ("UV", Int) = 0
+ _OutlineMask ("Outline Mask--{reference_properties:[_OutlineMaskPan, _OutlineMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_OutlineMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _OutlineMaskUV ("UV", Int) = 0
+ _OutlineShadowStrength ("Shadow Strength", Range(0, 1)) = 1
+
+ [ThryToggleUI(true)]_OutlineHueShift ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _OutlineHueOffset ("Shift--{condition_showS:(_OutlineHueShift==1)}", Range(0, 1)) = 0
+ _OutlineHueOffsetSpeed ("Shift Speed--{condition_showS:(_OutlineHueShift==1)}", Float) = 0
+ [HideInInspector] m_start_outlineAdvanced ("Advanced", Float) = 0
+ [ToggleUI]_OutlineClipAtZeroWidth ("Clip 0 Width", Float) = 0
+ [ToggleUI]_OutlineOverrideAlpha ("Override Base Alpha", Float) = 0
+ _Offset_Z ("Cam Z Offset", Float) = 0
+ //[Vector2]_OutlineFadeDistance ("Outline distance Fade", Vector) = (0, 0, 0, 0)
+ [Enum(UnityEngine.Rendering.CullMode)] _OutlineCull ("Cull", Float) = 1
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineZTest ("ZTest", Float) = 4
+ [HideInInspector] m_end_outlineAdvanced ("Advanced", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ // Outline Stencil
+ [HideInInspector] m_start_OutlineStencil ("Outline Stencil", Float) = 0
+ [IntRange] _OutlineStencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _OutlineStencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _OutlineStencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _OutlineStencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _OutlineStencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_OutlineStencil ("Outline Stencil", Float) = 0
+
+ // Outline Blending Options
+ [HideInInspector] m_start_outlineBlending ("Outline Blending", Float) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _OutlineSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _OutlineDstBlend ("Destination Blend", Int) = 0
+ [HideInInspector] m_end_outlineBlending ("Outline Blending", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_OutlineStencilRef]
+ ReadMask [_OutlineStencilReadMask]
+ WriteMask [_OutlineStencilWriteMask]
+ Comp [_OutlineStencilCompareFunction]
+ Pass [_OutlineStencilPassOp]
+ Fail [_OutlineStencilFailOp]
+ ZFail [_OutlineStencilZFailOp]
+ }
+
+ /*
+ ColorMask [_ColorMask]
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ AlphaToMask [_AlphaToCoverage]
+ Cull [_OutlineCull]
+ */
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_OutlineZTest]
+ Cull [_OutlineCull]
+ Blend [_OutlineSrcBlend] [_OutlineDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_OUTLINE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_PASS_OUTLINE
+ // outline Vertex Options
+ float _OutlineMode;
+ float4 _OutlinePersonaDirection;
+ float4 _OutlineDropShadowOffset;
+ float _OutlineUseVertexColors;
+ float _OutlineFixedSize;
+ float _EnableOutlines;
+ float _OutlinesMaxDistance;
+ float _LineWidth;
+ float _OutlineEmission;
+ float4 _LineColor;
+ float _OutlineOverrideAlpha;
+ float _OutlineSpace;
+ texture2D _OutlineTexture; //TODO make this dynamically not read for lock in
+ float4 _OutlineTexture_ST;
+ float2 _OutlineTexturePan;
+ float _OutlineTextureUV;
+ float4 _OutlineFadeDistance;
+ float4 _OutlineGlobalPan;
+ sampler2D _OutlineMask;
+ float4 _OutlineMask_ST;
+ float2 _OutlineMaskPan;
+ float _OutlineMaskUV;
+ float _OutlineRimLightBlend;
+ float _OutlineLit;
+ float _OutlineTintMix;
+ half _OutlineHueOffset;
+ half _OutlineHueShift;
+ half _OutlineHueOffsetSpeed;
+ float _OutlineShadowStrength;
+ float _LineColorThemeIndex;
+ float _Offset_Z;
+ float _OutlineClipAtZeroWidth;
+ #endif
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_PASS_OUTLINE
+ void applyOutlineColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ clip(_EnableOutlines - 0.01);
+ float OutlineMask = tex2D(_OutlineMask, TRANSFORM_TEX(poiMesh.uv[_OutlineMaskUV], _OutlineMask) + _Time.x * _OutlineMaskPan).r;
+ if (_OutlineClipAtZeroWidth)
+ {
+ clip(OutlineMask * _LineWidth - 0.001);
+ }
+ float4 col = POI2D_SAMPLER_PAN(_OutlineTexture, _MainTex, poiUV(poiMesh.uv[_OutlineTextureUV], _OutlineTexture_ST), _OutlineTexturePan) * float4(poiThemeColor(poiMods, _LineColor.rgb, _LineColorThemeIndex), _LineColor.a);
+ //UNITY_BRANCH
+ if (_OutlineMode == 0)
+ {
+ poiFragData.baseColor = col;
+ }
+ //UNITY_BRANCH
+ if (_OutlineMode == 1)
+ {
+ poiFragData.baseColor = lerp(float4(poiThemeColor(poiMods, _LineColor.rgb, _LineColorThemeIndex), _LineColor.a), poiFragData.baseColor, _OutlineTintMix) * col;
+ }
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiLight.directColor, _OutlineRimLightBlend) * col;
+ }
+
+ if (_OutlineOverrideAlpha)
+ {
+ poiFragData.alpha = col.a;
+ }
+ else
+ {
+ poiFragData.alpha *= col.a;
+ }
+
+ // Hue shift
+ //UNITY_BRANCH
+ if (_OutlineHueShift)
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, _OutlineHueOffset +_OutlineHueOffsetSpeed * _Time.x);
+ }
+
+ poiFragData.emission += poiFragData.baseColor * _OutlineEmission;
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_PASS_OUTLINE
+ applyOutlineColor(poiFragData, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ /*
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ */
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ #ifdef POI_PASS_OUTLINE
+ float outlineMask = 1;
+ //TODO figure out why uvs can't be set dynamically
+ outlineMask = poiMax(tex2Dlod(_OutlineMask, float4(poiUV(o.uv[0], _OutlineMask_ST) + _Time.x * _OutlineMaskPan, 0, 0)).rgb);
+
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 2)
+ {
+ outlineMask *= v.color.r;
+ }
+
+ float3 outlineNormal;
+ if (_OutlineSpace == 0)
+ {
+ outlineNormal = o.normal;
+ }
+ else
+ {
+ outlineNormal = v.normal;
+ }
+ //UNITY_BRANCH
+ if (_OutlineUseVertexColors == 1)
+ {
+ //TODO normals appear to be transformed before entering the vertex shader and I'm not sure how to achieve the same results with vertex colors
+ outlineNormal = UnityObjectToWorldNormal(v.color);
+ }
+
+ half offsetMultiplier = 1;
+ half distanceOffset = 1;
+ //UNITY_BRANCH
+ if (_OutlineFixedSize)
+ {
+ distanceOffset *= min(distance(_WorldSpaceCameraPos, mul(unity_ObjectToWorld, o.localPos).xyz), _OutlinesMaxDistance);
+ }
+
+ float3 offset = outlineNormal * (_LineWidth * _EnableOutlines / 100) * outlineMask * distanceOffset;
+
+ //UNITY_BRANCH
+ if (_OutlineMode == 2)
+ {
+ float3 lightDirection = normalize(_WorldSpaceLightPos0 + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz);
+ offsetMultiplier = saturate(dot(lightDirection, outlineNormal));
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 3)
+ {
+ half3 viewNormal = mul((float3x3)UNITY_MATRIX_V, outlineNormal);
+ offsetMultiplier = saturate(dot(viewNormal.xy, normalize(_OutlinePersonaDirection.xy)));
+
+ offset *= offsetMultiplier;
+ offset *= distanceOffset;
+ }
+ else if (_OutlineMode == 4)
+ {
+ offset = mul((float3x3)transpose(UNITY_MATRIX_V), _OutlineDropShadowOffset);
+ offset *= distanceOffset;
+ }
+ if (_OutlineSpace == 0)
+ {
+ localOffset += offset;
+ worldOffset += mul(unity_ObjectToWorld, offset);
+ }
+ else
+ {
+ localOffset += mul(unity_WorldToObject, offset);
+ worldOffset += offset;
+ }
+ #endif
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ #ifdef POI_PASS_OUTLINE
+ poiMesh.normals[1] = poiMesh.normals[0];
+ #endif
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Outline.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Outline.shader.meta
new file mode 100755
index 00000000..20338465
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro Outline.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: 1b50d0b2dd4c62844bc0df72edcda263
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro World.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro World.shader
new file mode 100644
index 00000000..63b263c9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro World.shader
@@ -0,0 +1,30357 @@
+Shader ".poiyomi/Poiyomi 8.1/Poiyomi Pro World"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.1.052</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:16},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:16},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:16},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:16},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:16},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ [ThryToggleUI(true)] _DecalTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _Decal0TPSMaskStrength ("Mask r Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal1TPSMaskStrength ("Mask g Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal2TPSMaskStrength ("Mask b Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal3TPSMaskStrength ("Mask a Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_tps_penetrator ("Penetrator--{reference_property:_TPSPenetratorEnabled,tooltip:Enable TPS Penetrator: Requires the TPS Setup Wizard to be run (under Poi/TPS)}", Float) = 0
+ [HideInInspector] m_start_pen_autoConfig ("Configured By Tool", Float) = 0
+ _TPS_PenetratorLength ("Length of Penetrator Model--{tooltip:The length from the root of the P to the very tip}", Float) = 1
+ [Vector3]_TPS_PenetratorScale ("Scale of Penetrator Model", Vector) = (1, 1, 1, 1)
+ [Vector3]_TPS_PenetratorRight ("Right Vector", Vector) = (1, 0, 0, 0)
+ [Vector3]_TPS_PenetratorUp ("Up Vector", Vector) = (0, 1, 0, 0)
+ [Vector3]_TPS_PenetratorForward ("Forward Vector", Vector) = (0, 0, 1, 0)
+ [Toggle(TPS_ISSKINNEDMESH)]_TPS_IsSkinnedMeshRenderer ("Baked Vertex Colors", Float) = 0
+ [HideInInspector] m_end_pen_autoConfig ("TPS", Float) = 0
+ [Helpbox(1)]_TPSHelpbox ("Penetrator allows your mesh to bend in the direction of an orifice. It is fully compatible with DPS. Requires the TPS Setup Wizard to be run afterwards. Click here to open the setup window.--{onClick:Thry.TPS.TPS_Setup}", Float) = 0
+ [HideInInspector][ThryToggle(TPS_PENETRATOR)]_TPSPenetratorEnabled ("Enabled", Float) = 0
+ [Space(10)]
+ [ThryRichLabel(13)]_TPSBezierHeader ("Bezier--{tooltip: Changes how the penetrator bends}", Float) = 0
+ _TPS_BezierStart ("Bezier Start--{tooltip:Start later down the penetrator}", Range(0, 0.3)) = 0.0
+ _TPS_BezierSmoothness ("Bezier Smoothness--{tooltip:Smoothness of bending}", Range(0.2, 0.05)) = 0.09
+ [ThryRichLabel(13)]_TPSSqueezeHeader ("Squeeze--{tooltip:Penetrator contracts when entering an orifice}", Float) = 0
+ _TPS_Squeeze ("Squeeze Strength--{tooltip:Percentage penetrator squeezes}", Range(0, 1)) = 0.3
+ _TPS_SqueezeDistance ("Squeeze Distance--{tooltip:Width of the squeezing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSBuldgeHeader ("Buldge--{tooltip: Penetrator expands in front of the orifice}", Float) = 0
+ _TPS_Buldge ("Buldge--{tooltip:Amount in percentage}", Range(0, 3)) = 0.3
+ _TPS_BuldgeDistance ("Buldge Distance--{tooltip:Width of the buldging}", Range(0.01, 1)) = 0.2
+ _TPS_BuldgeFalloffDistance ("Buldge Falloff--{tooltip:Width of bulding in front of orifice}", Range(0.01, 0.5)) = 0.05
+ [ThryRichLabel(13)]_TPSPulsingHeader ("Pulsing--{tooltip: Penetrator expands in pulses while entering orifice}", Float) = 0
+ _TPS_PumpingStrength ("Pumping Strength--{tooltip:Amount in percentage}", Range(0, 1)) = 0
+ _TPS_PumpingSpeed ("Pumping Speed--{tooltip:Frequenzy of pulsing}", Range(0, 10)) = 0
+ _TPS_PumpingWidth ("Pumping Width--{tooltip:Width of pulsing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSIdleHeader ("Idle--{tooltip: Changes how the penetrator bends while no orifice is near}", Float) = 0
+ [Helpbox(0)]_TPS_IdleGravity ("Tip: For idle gravity & movement use physbones gravity & other functions", Float) = 0
+ _TPS_IdleSkrinkWidth ("Idle Shrink Width--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ _TPS_IdleSkrinkLength ("Idle Shrink Length--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ //Hide These, animated only
+ [HideInInspector]_TPS_BufferedDepth ("_TPS2_BufferedDepth NL", Float) = 0
+ [HideInInspector]_TPS_BufferedStrength ("_TPS2_BufferedStrength NL", Float) = 0
+ [HideInInspector] m_end_tps_penetrator ("", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [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)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ _SDFShadingTexture ("SDF--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ _SDFBlur ("Blur--{condition_showS:(_LightingMode==8)}", Range(0, 1)) = 0.1
+ [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)
+
+ // 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)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_bakedLighting ("Baked Lighting", Float) = 0
+ //_SpecularLMOcclusion ("Specular Occlusion", Range(0, 1)) = 0
+ //_SpecLMOcclusionAdjust ("Spec Occlusion Sensitiviy", Range(0, 1)) = 0.2
+ _GIEmissionMultiplier ("GI Emission Multiplier", Float) = 1
+ [HideInInspector] DSGI ("DSGI", Float) = 0 //add this property for double sided illumination settings to be shown
+ [HideInInspector] LightmapFlags ("Lightmap Flags", Float) = 0 //add this property for lightmap flags settings to be shown
+ [HideInInspector] m_end_bakedLighting ("Baked Lighting", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _MatcapTPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _MatcapTPSMaskStrength ("TPS Mask Strength--{condition_showS:(_MatcapTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _Matcap2TPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _Matcap2TPSMaskStrength ("TPS Mask Strength--{condition_showS:(_Matcap2TPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBrightness ("Brightness--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_depthRimLightOptions ("Depth Rim Lighting--{reference_property:_EnableDepthRimLighting}", 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
+ _DepthRimWidth ("Width", Range(0, 1)) = .2
+ _DepthRimSharpness ("Depth", Range(0, 1)) = .2
+ [ToggleUI]_DepthRimHideInShadow ("Hide In Shadow", Float) = 0
+
+ [Space][ThryHeaderLabel(Color and Blending, 13)]
+ _DepthRimMixBaseColor ("Use Base Color", Range(0, 1)) = 0
+ _DepthRimMixLightColor ("Light Color Mix", Range(0, 1)) = 0
+ _DepthRimColor ("Rim Color--{reference_property:_DepthRimColorThemeIndex}", Color) = (1, 1, 1, 1)
+ _DepthRimBrightness ("Color Brightness", Range(0, 10)) = 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)] _DepthRimColorThemeIndex ("", Int) = 0
+ _DepthRimEmission ("Emission", Range(0, 20)) = 0
+ _DepthRimReplace ("Replace", Range(0, 1)) = 0
+ _DepthRimAdd ("Add", Range(0, 1)) = 0
+ _DepthRimMultiply ("Multiply", Range(0, 1)) = 0
+ _DepthRimAdditiveLighting ("Add to Light", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthRimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ThryToggleUI(true)] _BRDFTPSDepthEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _BRDFTPSReflectionMaskStrength ("Reflection Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ _BRDFTPSSpecularMaskStrength ("Specular Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0, 1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ [ThryToggleUI(true)] _ClearCoatTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _ClearCoatTPSMaskStrength ("Mask Strength--{condition_showS:(_ClearCoatTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ //Third party
+ [HideInInspector] m_thirdpartyCategory ("Third Party", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "Meta" }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ //#pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_META
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _GIEmissionMultiplier;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #if defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ #ifdef POI_PASS_META
+ UnityMetaInput meta;
+ UNITY_INITIALIZE_OUTPUT(UnityMetaInput, meta);
+ meta.Emission = poiFragData.emission * _GIEmissionMultiplier * poiMods.globalEmission;
+ meta.Albedo = saturate(poiFragData.finalColor.rgb);
+ meta.SpecularColor = poiLight.finalLightAdd;
+ return UnityMetaFragment(meta);
+ #endif
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro World.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro World.shader.meta
new file mode 100755
index 00000000..cc982a90
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro World.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: 7b930b87172049241bbd94d0763b9c48
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro.shader
new file mode 100644
index 00000000..0e9fd311
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro.shader
@@ -0,0 +1,24102 @@
+Shader ".poiyomi/Poiyomi 8.1/Poiyomi Pro"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.1.052</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:16},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:16},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:16},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:16},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:16},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ [ThryToggleUI(true)] _DecalTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _Decal0TPSMaskStrength ("Mask r Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal1TPSMaskStrength ("Mask g Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal2TPSMaskStrength ("Mask b Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal3TPSMaskStrength ("Mask a Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_tps_penetrator ("Penetrator--{reference_property:_TPSPenetratorEnabled,tooltip:Enable TPS Penetrator: Requires the TPS Setup Wizard to be run (under Poi/TPS)}", Float) = 0
+ [HideInInspector] m_start_pen_autoConfig ("Configured By Tool", Float) = 0
+ _TPS_PenetratorLength ("Length of Penetrator Model--{tooltip:The length from the root of the P to the very tip}", Float) = 1
+ [Vector3]_TPS_PenetratorScale ("Scale of Penetrator Model", Vector) = (1, 1, 1, 1)
+ [Vector3]_TPS_PenetratorRight ("Right Vector", Vector) = (1, 0, 0, 0)
+ [Vector3]_TPS_PenetratorUp ("Up Vector", Vector) = (0, 1, 0, 0)
+ [Vector3]_TPS_PenetratorForward ("Forward Vector", Vector) = (0, 0, 1, 0)
+ [Toggle(TPS_ISSKINNEDMESH)]_TPS_IsSkinnedMeshRenderer ("Baked Vertex Colors", Float) = 0
+ [HideInInspector] m_end_pen_autoConfig ("TPS", Float) = 0
+ [Helpbox(1)]_TPSHelpbox ("Penetrator allows your mesh to bend in the direction of an orifice. It is fully compatible with DPS. Requires the TPS Setup Wizard to be run afterwards. Click here to open the setup window.--{onClick:Thry.TPS.TPS_Setup}", Float) = 0
+ [HideInInspector][ThryToggle(TPS_PENETRATOR)]_TPSPenetratorEnabled ("Enabled", Float) = 0
+ [Space(10)]
+ [ThryRichLabel(13)]_TPSBezierHeader ("Bezier--{tooltip: Changes how the penetrator bends}", Float) = 0
+ _TPS_BezierStart ("Bezier Start--{tooltip:Start later down the penetrator}", Range(0, 0.3)) = 0.0
+ _TPS_BezierSmoothness ("Bezier Smoothness--{tooltip:Smoothness of bending}", Range(0.2, 0.05)) = 0.09
+ [ThryRichLabel(13)]_TPSSqueezeHeader ("Squeeze--{tooltip:Penetrator contracts when entering an orifice}", Float) = 0
+ _TPS_Squeeze ("Squeeze Strength--{tooltip:Percentage penetrator squeezes}", Range(0, 1)) = 0.3
+ _TPS_SqueezeDistance ("Squeeze Distance--{tooltip:Width of the squeezing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSBuldgeHeader ("Buldge--{tooltip: Penetrator expands in front of the orifice}", Float) = 0
+ _TPS_Buldge ("Buldge--{tooltip:Amount in percentage}", Range(0, 3)) = 0.3
+ _TPS_BuldgeDistance ("Buldge Distance--{tooltip:Width of the buldging}", Range(0.01, 1)) = 0.2
+ _TPS_BuldgeFalloffDistance ("Buldge Falloff--{tooltip:Width of bulding in front of orifice}", Range(0.01, 0.5)) = 0.05
+ [ThryRichLabel(13)]_TPSPulsingHeader ("Pulsing--{tooltip: Penetrator expands in pulses while entering orifice}", Float) = 0
+ _TPS_PumpingStrength ("Pumping Strength--{tooltip:Amount in percentage}", Range(0, 1)) = 0
+ _TPS_PumpingSpeed ("Pumping Speed--{tooltip:Frequenzy of pulsing}", Range(0, 10)) = 0
+ _TPS_PumpingWidth ("Pumping Width--{tooltip:Width of pulsing}", Range(0.01, 1)) = 0.2
+ [ThryRichLabel(13)]_TPSIdleHeader ("Idle--{tooltip: Changes how the penetrator bends while no orifice is near}", Float) = 0
+ [Helpbox(0)]_TPS_IdleGravity ("Tip: For idle gravity & movement use physbones gravity & other functions", Float) = 0
+ _TPS_IdleSkrinkWidth ("Idle Shrink Width--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ _TPS_IdleSkrinkLength ("Idle Shrink Length--{tooltip:P shrinks while not penetrating}", Range(0, 1)) = 1
+ //Hide These, animated only
+ [HideInInspector]_TPS_BufferedDepth ("_TPS2_BufferedDepth NL", Float) = 0
+ [HideInInspector]_TPS_BufferedStrength ("_TPS2_BufferedStrength NL", Float) = 0
+ [HideInInspector] m_end_tps_penetrator ("", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [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)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ _SDFShadingTexture ("SDF--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ _SDFBlur ("Blur--{condition_showS:(_LightingMode==8)}", Range(0, 1)) = 0.1
+ [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)
+
+ // 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)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _MatcapTPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _MatcapTPSMaskStrength ("TPS Mask Strength--{condition_showS:(_MatcapTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _Matcap2TPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _Matcap2TPSMaskStrength ("TPS Mask Strength--{condition_showS:(_Matcap2TPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBrightness ("Brightness--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_depthRimLightOptions ("Depth Rim Lighting--{reference_property:_EnableDepthRimLighting}", 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
+ _DepthRimWidth ("Width", Range(0, 1)) = .2
+ _DepthRimSharpness ("Depth", Range(0, 1)) = .2
+ [ToggleUI]_DepthRimHideInShadow ("Hide In Shadow", Float) = 0
+
+ [Space][ThryHeaderLabel(Color and Blending, 13)]
+ _DepthRimMixBaseColor ("Use Base Color", Range(0, 1)) = 0
+ _DepthRimMixLightColor ("Light Color Mix", Range(0, 1)) = 0
+ _DepthRimColor ("Rim Color--{reference_property:_DepthRimColorThemeIndex}", Color) = (1, 1, 1, 1)
+ _DepthRimBrightness ("Color Brightness", Range(0, 10)) = 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)] _DepthRimColorThemeIndex ("", Int) = 0
+ _DepthRimEmission ("Emission", Range(0, 20)) = 0
+ _DepthRimReplace ("Replace", Range(0, 1)) = 0
+ _DepthRimAdd ("Add", Range(0, 1)) = 0
+ _DepthRimMultiply ("Multiply", Range(0, 1)) = 0
+ _DepthRimAdditiveLighting ("Add to Light", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthRimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ThryToggleUI(true)] _BRDFTPSDepthEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _BRDFTPSReflectionMaskStrength ("Reflection Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ _BRDFTPSSpecularMaskStrength ("Specular Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0, 1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ [ThryToggleUI(true)] _ClearCoatTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _ClearCoatTPSMaskStrength ("Mask Strength--{condition_showS:(_ClearCoatTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ //Third party
+ [HideInInspector] m_thirdpartyCategory ("Third Party", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ float _SDFBlur;
+ float4 _SDFForward;
+ float4 _SDFLeft;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ float _RimBrightness;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ float _DepthRimNormalToUse;
+ float _DepthRimWidth;
+ float _DepthRimSharpness;
+ float _DepthRimHideInShadow;
+ float4 _DepthRimColor;
+ float _DepthRimColorThemeIndex;
+ float _DepthRimMixBaseColor;
+ float _DepthRimEmission;
+ float _DepthRimReplace;
+ float _DepthRimAdd;
+ float _DepthRimMultiply;
+ float _DepthRimAdditiveLighting;
+ 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,
+ 1, 0, -1
+ };
+ static float sobelYMatrix[9] = {
+ 1, 2, 1,
+ 0, 0, 0,
+ - 1, -2, -1
+ };
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+ float _ClearCoatTPSDepthMaskEnabled;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _IridescenceAudioLinkEmissionAddBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #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
+ float shadowSDF = float2(1,1);
+ #endif
+ float blur = _SDFBlur * 0.1;
+ float faceShadow = smoothstep(lightAtten-blur, lightAtten+blur, shadowSDF);
+
+ 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);
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+ finalRimColor *= _RimBrightness;
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #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;
+ float perspectiveDivide = 1.0f / poiCam.clipPos.w;
+ float4 direction = poiCam.worldDirection * perspectiveDivide;
+ float2 screenPos = poiCam.grabPos.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);
+ }
+ break;
+ case 1:
+ {
+ //float lDotN = saturate(poiLight.nDotL + _RimLightLength);
+ float scale = _DepthRimWidth * GetSSRimScale(depth);
+ float depthDiff = 0;
+ for (int i = 0; i < 9; i++)
+ {
+ float2 ssUV1 = clamp(screenPos + sobelSamplePoints[i] * .1 * scale, 0, _ScreenParams.xy - 1);
+ depthDiff = max(depthDiff, z - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, ssUV1));
+ }
+ rim = smoothstep(0.24 * _DepthRimSharpness * z, 0.25 * z, depthDiff);
+ rim *= lerp(1, lerp(poiLight.vertexNDotL > 0, poiLight.nDotL > 0, _DepthRimNormalToUse), _DepthRimHideInShadow);
+ }
+ break;
+ }
+
+ float3 rimColor = poiThemeColor(poiMods, _DepthRimColor.rgb, _DepthRimColorThemeIndex).rgb * lerp(1, poiLight.directColor, _DepthRimMixLightColor) * lerp(1, poiFragData.baseColor, _DepthRimMixBaseColor) * _DepthRimBrightness;
+
+ poiLight.finalLightAdd += rim * rimColor * _DepthRimAdditiveLighting;
+ poiFragData.emission += rim * rimColor * _DepthRimEmission;
+ poiFragData.baseColor = lerp(poiFragData.baseColor, rimColor, rim * _DepthRimReplace);
+ poiFragData.baseColor += rim * rimColor * _DepthRimAdd;
+ poiFragData.baseColor *= lerp(1, rimColor, rim * _DepthRimMultiply);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength * _ClearCoatTPSDepthMaskEnabled);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 1;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_IridescenceAudioLinkEmissionAddBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _POI_DEPTH_RIMLIGHT
+ if (!IsInMirror())
+ {
+ ApplyDepthRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ }
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature_local _POI_DEPTH_RIMLIGHT
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma shader_feature_local TPS_PENETRATOR
+ #pragma shader_feature_local TPS_ISSKINNEDMESH
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef TPS_PENETRATOR
+ float _TPS_PenetratorLength;
+ float3 _TPS_PenetratorScale;
+ float3 _TPS_PenetratorForward;
+ float3 _TPS_PenetratorRight;
+ float3 _TPS_PenetratorUp;
+ float _TPS_VertexColors;
+ float _TPS_MinimumOrificeDistance;
+ float _TPS_BezierStart;
+ float _TPS_BezierSmoothness;
+ float _TPS_Squeeze;
+ float _TPS_SqueezeDistance;
+ float _TPS_Buldge;
+ float _TPS_BuldgeDistance;
+ float _TPS_BuldgeFalloffDistance;
+
+ float _TPS_PumpingStrength;
+ float _TPS_PumpingSpeed;
+ float _TPS_PumpingWidth;
+
+ float _TPS_IdleSkrinkWidth;
+ float _TPS_IdleSkrinkLength;
+
+ float _TPS_BufferedDepth;
+ float _TPS_BufferedStrength;
+
+ UNITY_DECLARE_SCREENSPACE_TEXTURE(_TPS2_Grabpass);
+
+ #define ID_HOLE 0.41
+ #define ID_RING 0.42
+ #define ID_NORM 0.45
+
+ #define TPS_RECIEVER_DIST 0.01
+
+ #define PENETRATORTYPE_RING 1
+ #define PENETRATORTYPE_HOLE 2
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ #ifdef TPS_PENETRATOR
+ //https://forum.unity.com/threads/point-light-in-v-f-shader.499717/ UGA BUGA, Unity Forums pogggggggg
+ float LightRange(int i)
+ {
+ return (0.005 * sqrt(1000000.0 - unity_4LightAtten0[i])) / sqrt(unity_4LightAtten0[i]);
+ }
+
+ float4 GetLightPositionInObjectSpace(int i)
+ {
+ return mul(unity_WorldToObject, float4(unity_4LightPosX0[i], unity_4LightPosY0[i], unity_4LightPosZ0[i], 1));
+ }
+
+ uint4 f32touint8(float4 input)
+ {
+ input.r = LinearToGammaSpaceExact(input.r);
+ input.g = LinearToGammaSpaceExact(input.g);
+ input.b = LinearToGammaSpaceExact(input.b);
+ return round(input * 255);
+ }
+
+ float decodeFloatFromARGB8(float4 rgba)
+ {
+ uint4 u = f32touint8(rgba);
+ return asfloat(u.x + (u.y << 8) + (u.z << 16) + (u.w << 24));
+ }
+
+ #if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
+ #define SampleGrabpass(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3(uv.xy, 0), 0)
+ #elif UNITY_SINGLE_PASS_STEREO
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.x * 0.5, uv.y, 0, 0))
+ #else
+ #define SampleGrabpass(tex, uv) tex2Dlod(tex, float4(uv.xy, 0, 0))
+ #endif
+
+ #define IsLightOrificeType(range, type) (abs(range - type) < 0.001)
+ #define IsLightAnyOrificeType(range) ((IsLightOrificeType(range, ID_RING)) || (IsLightOrificeType(range, ID_HOLE)))
+ #define VectorLengthIntoDirection(v, d) dot(v, d)
+
+ float FindTPSSystem(inout float3 orificePosition, inout float3 orificeNormal, inout float penetratorType, float penetratorLength)
+ {
+ //find lights
+ float lightRanges[4];
+ float3 lightPositions[4];
+ float3 lightPositionsWorld[4];
+ [loop] for (int f = 0; f < 4; f++)
+ {
+ lightPositions[f] = GetLightPositionInObjectSpace(f);
+ lightPositionsWorld[f] = length(mul(unity_ObjectToWorld, float4(lightPositions[f], 1)));
+ lightRanges[f] = LightRange(f);
+ }
+ //orifice hole + type
+ float closestOrfDist = 100000000;
+ [loop]for (int i = 0; i < 4; i++)
+ {
+ if (abs(lightRanges[i] - ID_RING) < 0.001 || abs(lightRanges[i] - ID_HOLE) < 0.001)
+ {
+ //Ceck if orifice light is in forward direction
+ if (dot(_TPS_PenetratorForward, lightPositions[i]) > 0)
+ {
+ //Check if normal exisits
+ float3 foundNormal = -_TPS_PenetratorForward;
+ bool hasNormal = false;
+ [loop] for (int n = 0; n < 4; n++)
+ {
+ //orifice normal
+ if (IsLightOrificeType(lightRanges[n], ID_NORM) && distance(lightPositionsWorld[n], lightPositionsWorld[i]) < 0.05f)
+ {
+ foundNormal = normalize(lightPositions[n] - lightPositions[i]);
+ hasNormal = true;
+ }
+ }
+ //if normal right direction and is cloest orifice
+ if (dot(foundNormal, _TPS_PenetratorForward) < 0 && length(lightPositions[i]) < closestOrfDist)
+ {
+ closestOrfDist = length(lightPositions[i]);
+ orificePosition = lightPositions[i];
+ penetratorType = abs(lightRanges[i] - ID_HOLE) < 0.001 ? PENETRATORTYPE_HOLE : PENETRATORTYPE_RING;
+ orificeNormal = (float3)0 * (1 - hasNormal) + foundNormal * hasNormal;
+ }
+ }
+ }
+ }
+ //Guess normal of normal not existing
+ if (length(orificeNormal) == 0)
+ {
+ orificeNormal = lerp(normalize(-orificePosition), -_TPS_PenetratorForward, max(dot(normalize(orificePosition), _TPS_PenetratorForward), 0.5));
+ }
+
+ #ifdef TPS_ISSKINNEDMESH
+ return (closestOrfDist) < (2 * penetratorLength);
+ #else
+ return (closestOrfDist) < (1.5 * penetratorLength);
+ #endif
+ }
+
+ //https://vicrucann.github.io/tutorials/bezier-shader/
+ float3 toBezier(float t, float3 P0, float3 P1, float3 P2, float3 P3)
+ {
+ float t2 = t * t;
+ float one_minus_t = 1.0 - t;
+ float one_minus_t2 = one_minus_t * one_minus_t;
+ return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);
+ }
+
+ void ApplyTPSPenetrator(inout float4 vertex, inout float3 normal, float3 vertexColor)
+ {
+ float orificeType = (float3)0;
+ float3 orificePosition = (float3)0;
+ float3 orificeNormal = (float3)0;
+ float penetratorLength = _TPS_PenetratorLength;
+ // Adjust pen length for scaled non skinned renderers
+ #ifndef TPS_ISSKINNEDMESH
+ float3 scale = float3(
+ length(float3(unity_ObjectToWorld[0].x, unity_ObjectToWorld[1].x, unity_ObjectToWorld[2].x)), // scale x axis
+ length(float3(unity_ObjectToWorld[0].y, unity_ObjectToWorld[1].y, unity_ObjectToWorld[2].y)), // scale y axis
+ length(float3(unity_ObjectToWorld[0].z, unity_ObjectToWorld[1].z, unity_ObjectToWorld[2].z)) // scale z axis
+ );
+ // Mesh Renderers arent getting skinned => verticies are still in object space => _TPS_PenetratorLength needs to be scaled to object space
+ penetratorLength = penetratorLength / abs(VectorLengthIntoDirection(scale, _TPS_PenetratorForward));
+ #endif
+
+ //Idle shrinkage
+ float2 shrinkage = float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength);
+
+ //Idle Position
+ //Fix idle gravity
+ float3 targetPosition = _TPS_PenetratorForward * penetratorLength;
+ float3 targetNormal = -_TPS_PenetratorForward;
+
+ //Default values
+ float tpsSmoothStart = 0;
+ float tpsSmoothStart2 = 0;
+
+ float bezierSmoothness = _TPS_BezierSmoothness;
+ float penetrationDepth = 0;
+
+ //Find tps system, calculate values
+ [branch] if (FindTPSSystem(orificePosition, orificeNormal, orificeType, penetratorLength))
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ tpsSmoothStart = saturate((penetratorLength * 2 - length(orificePosition)) / penetratorLength);
+ #else
+ tpsSmoothStart = saturate((penetratorLength * 1.5 - length(orificePosition)) / (penetratorLength * 0.5));
+ #endif
+ tpsSmoothStart2 = saturate((penetratorLength - length(orificePosition)) * 20);
+
+ targetPosition = lerp(targetPosition, orificePosition, tpsSmoothStart);
+ targetNormal = lerp(targetNormal, orificeNormal, tpsSmoothStart);
+
+ penetrationDepth = 1 - saturate(length(orificePosition) / penetratorLength);
+ //smoothness goes to 0 when close to oriface to prevent weird batching
+ bezierSmoothness = lerp(_TPS_BezierSmoothness, 0, penetrationDepth);
+
+ shrinkage = lerp(float2(_TPS_IdleSkrinkWidth, _TPS_IdleSkrinkLength), float2(1, 1), saturate(tpsSmoothStart * 2));
+ }
+
+ //Vertex color stuff for dyn bones
+
+ #ifdef TPS_ISSKINNEDMESH
+ // Vertex color has been baked with different rotation
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+
+ float3 bezier0 = _TPS_PenetratorForward * _TPS_BezierStart;
+ float3 bezier0Out = bezier0 + _TPS_PenetratorForward * bezierSmoothness;
+ float3 bezier1 = targetPosition;
+ float3 bezier1In = bezier1 + targetNormal * bezierSmoothness;
+
+ float bezierStrengthUncapped = ((penZ - _TPS_BezierStart) / distance(bezier0, bezier1));
+ float bezierStrength = saturate(bezierStrengthUncapped);
+
+ //Bezier curve, calculate two points, calculate forward, right, up vectors
+ float3 bezierPoint = toBezier(bezierStrength, bezier0, bezier0Out, bezier1In, bezier1);
+ float3 bezierPoint2 = toBezier(bezierStrength + 0.01f, bezier0, bezier0Out, bezier1In, bezier1);
+
+ if (orificeType == PENETRATORTYPE_RING && bezierStrength == 1 && tpsSmoothStart == 1)
+ {
+ bezierPoint = orificePosition + (penZ - _TPS_BezierStart - length(orificePosition.xyz)) * - orificeNormal;
+ bezierPoint2 = bezierPoint - orificeNormal;
+ }
+
+ float3 bezierForward = normalize(bezierPoint2 - bezierPoint);
+ float3 bezierRight = normalize(cross(_TPS_PenetratorUp, bezierForward));
+ float3 bezierUp = normalize(cross(bezierForward, bezierRight));
+
+ //calculate new position and normal
+ if (bezierStrength > 0)
+ {
+ //pumping
+ float sizeChange = 1;
+ if (_TPS_PumpingStrength > 0)
+ {
+ sizeChange *= lerp(1 - _TPS_PumpingStrength * tpsSmoothStart, 1 + _TPS_PumpingStrength * tpsSmoothStart, abs(sin(_Time.y * - _TPS_PumpingSpeed + bezierStrengthUncapped / _TPS_PumpingWidth)));
+ }
+ //buldging + squeezing
+ float buldgeLerp = 0;
+ if (bezierStrength < 1 - _TPS_BuldgeFalloffDistance)
+ buldgeLerp = saturate((bezierStrength - 1 + _TPS_BuldgeDistance + _TPS_BuldgeFalloffDistance) / _TPS_BuldgeDistance);
+ else
+ buldgeLerp = saturate((-bezierStrength + 1) / _TPS_BuldgeFalloffDistance);
+
+ //Squeezing while outside oriface makes penetrator looks weirly streched
+ float squeeze = lerp(0, _TPS_Squeeze, saturate(penetrationDepth * 20));
+ sizeChange *= lerp(1, 1 - squeeze, saturate(1 - abs(bezierStrengthUncapped - 1) / _TPS_SqueezeDistance) * tpsSmoothStart);
+ sizeChange *= lerp(1, 1 + _TPS_Buldge, buldgeLerp * tpsSmoothStart2);
+
+ //Calc idle shrinkage
+ shrinkage = lerp(1, shrinkage, saturate((penZ - _TPS_BezierStart) * 20));
+ //Apply vertex + normal
+ #ifdef TPS_ISSKINNEDMESH
+ float x = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorUp);
+ #else
+ float x = VectorLengthIntoDirection(vertex, _TPS_PenetratorRight);
+ float y = VectorLengthIntoDirection(vertex, _TPS_PenetratorUp);
+ #endif
+ float3 normalX = VectorLengthIntoDirection(normal, _TPS_PenetratorRight);
+ float3 normalY = VectorLengthIntoDirection(normal, _TPS_PenetratorUp);
+ float3 normalZ = VectorLengthIntoDirection(normal, _TPS_PenetratorForward);
+
+ float3 vertexZ = _TPS_PenetratorForward * VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ float3 vertexXY = vertex.xyz - vertexZ;
+ vertex.xyz = shrinkage.y * vertexZ + shrinkage.x * vertexXY;
+
+ vertex.xyz = lerp(vertex.xyz, bezierPoint + x * bezierRight * sizeChange + y * bezierUp * sizeChange, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+ normal.xyz = lerp(normal.xyz, normalX * bezierRight + normalY * bezierUp + normalZ * bezierForward, tpsSmoothStart); //for dynamic bones, lerp between original and skinned vertecies
+
+ }
+ }
+
+ float TPSBufferedDepth(float3 vertex, float3 vertexColor)
+ {
+ #ifdef TPS_ISSKINNEDMESH
+ float penZ = VectorLengthIntoDirection(vertexColor * _TPS_PenetratorScale, _TPS_PenetratorForward);
+ #else
+ float penZ = VectorLengthIntoDirection(vertex, _TPS_PenetratorForward);
+ #endif
+ return saturate((penZ - (1 - _TPS_BufferedDepth)) * 10) * _TPS_BufferedStrength;
+ }
+ #endif
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ #ifdef TPS_PENETRATOR
+ ApplyTPSPenetrator(v.vertex, v.normal, v.color);
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro.shader.meta
new file mode 100755
index 00000000..51152dbe
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi Pro.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: 1787129096f7e4d45814aa4d2a62d45c
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi.shader
new file mode 100644
index 00000000..70d08a42
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi.shader
@@ -0,0 +1,22990 @@
+Shader ".poiyomi/Poiyomi 8.1/Poiyomi"
+{
+ Properties
+ {
+ [HideInInspector] shader_master_label ("<color=#E75898ff>Poiyomi 8.1.021</color>", Float) = 0
+ [HideInInspector] shader_is_using_thry_editor ("", Float) = 0
+ [HideInInspector] footer_youtube ("{texture:{name:icon-youtube,height:16},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}", Float) = 0
+ [HideInInspector] footer_twitter ("{texture:{name:icon-twitter,height:16},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}", Float) = 0
+ [HideInInspector] footer_patreon ("{texture:{name:icon-patreon,height:16},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}", Float) = 0
+ [HideInInspector] footer_discord ("{texture:{name:icon-discord,height:16},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}", Float) = 0
+ [HideInInspector] footer_github ("{texture:{name:icon-github,height:16},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB}", Float) = 0
+
+ // Keyword to remind users in the VRChat SDK that this material hasn't been locked. Inelegant but it works.
+ [HideInInspector] _ForgotToLockMaterial (";;YOU_FORGOT_TO_LOCK_THIS_MATERIAL;", Int) = 1
+ [ThryShaderOptimizerLockButton] _ShaderOptimizerEnabled ("", Int) = 0
+ [Helpbox(1)] _LockTooltip ("Animations don't work by default when locked in. Right click a property if you want to animate it. The shader will lock in automatically at upload time.", Int) = 0
+
+ [ThryWideEnum(Opaque, 0, Cutout, 1, TransClipping, 9, Fade, 2, Transparent, 3, Additive, 4, Soft Additive, 5, Multiplicative, 6, 2x Multiplicative, 7)]_Mode("Rendering Preset--{on_value_actions:[
+ {value:0,actions:[{type:SET_PROPERTY,data:render_queue=2000}, {type:SET_PROPERTY,data:render_type=Opaque}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:1,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=.5}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=1}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:9,actions:[{type:SET_PROPERTY,data:render_queue=2450}, {type:SET_PROPERTY,data:render_type=TransparentCutout}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=1}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:2,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=5}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:3,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=10}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=1}]},
+ {value:4,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=1}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:5,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:RenderType=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=4}, {type:SET_PROPERTY,data:_DstBlend=1}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:6,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=0}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]},
+ {value:7,actions:[{type:SET_PROPERTY,data:render_queue=3000}, {type:SET_PROPERTY,data:render_type=Transparent}, {type:SET_PROPERTY,data:_BlendOp=0}, {type:SET_PROPERTY,data:_BlendOpAlpha=0}, {type:SET_PROPERTY,data:_Cutoff=0}, {type:SET_PROPERTY,data:_SrcBlend=2}, {type:SET_PROPERTY,data:_DstBlend=3}, {type:SET_PROPERTY,data:_AlphaToMask=0}, {type:SET_PROPERTY,data:_ZWrite=0}, {type:SET_PROPERTY,data:_ZTest=4}, {type:SET_PROPERTY,data:_AlphaPremultiply=0}]}
+ }]}]}", Int) = 0
+
+ // Main
+ [HideInInspector] m_mainCategory ("Color & Normals", Float) = 0
+ //Main-main
+ _Color ("Color & Alpha--{reference_property:_ColorThemeIndex}", 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)] _ColorThemeIndex ("", Int) = 0
+ _MainTex ("Texture--{reference_properties:[_MainTexPan, _MainTexUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainTexUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_MainTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [Normal]_BumpMap ("Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV, _BumpScale]}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_BumpMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _BumpMapUV ("UV", Int) = 0
+ [HideInInspector]_BumpScale ("Intensity", Range(0, 10)) = 1
+ _ClippingMask ("Alpha Map--{reference_properties:[_ClippingMaskPan, _ClippingMaskUV, _Inverse_Clipping]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ClippingMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClippingMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Inverse_Clipping ("Invert", Float) = 0
+ _Cutoff ("Alpha Cutoff", Range(0, 1.001)) = 0.5
+
+ [HideInInspector] m_start_MainHueShift ("Color Adjust--{reference_property:_MainColorAdjustToggle}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR)] _MainColorAdjustToggle ("Adjust Colors", Float) = 0
+ [ThryRGBAPacker(R Hue Mask, G Brightness Mask, B Saturation Mask, A Nothing)]_MainColorAdjustTexture ("Mask (Expand)--{reference_properties:[_MainColorAdjustTexturePan, _MainColorAdjustTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MainColorAdjustTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MainColorAdjustTextureUV ("UV", Int) = 0
+ _Saturation ("Saturation", Range(-1, 10)) = 0
+ _MainBrightness ("Brightness", Range(-1, 1)) = 0
+ [ThryToggleUI(true)] _MainHueShiftToggle ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ [ToggleUI]_MainHueShiftReplace ("Hue Replace?--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 1
+ _MainHueShift ("Hue Shift--{condition_showS:(_MainHueShiftToggle==1)}", Range(0, 1)) = 0
+ _MainHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_MainHueShiftToggle==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_MainHueALCTEnabled ("<size=13><b> Hue Shift Audio Link</b></size>--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)]_MainALHueShiftBand ("Band--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", 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)]_MainALHueShiftCTIndex ("Motion Type--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Int) = 0
+ _MainHueALMotionSpeed ("Motion Speed--{condition_showS:(_MainHueShiftToggle==1 && _EnableAudioLink==1 && _MainHueALCTEnabled==1)}", Float) = 1
+ [HideInInspector] m_end_MainHueShift ("Hue Shift", Float) = 0
+
+ [HideInInspector] m_start_Alpha ("Alpha Options", Float) = 0
+ [ToggleUI]_AlphaForceOpaque ("Force Opaque", Float) = 0
+ _AlphaMod ("Alpha Mod", Range(-1, 1)) = 0.0
+ [ToggleUI]_AlphaPremultiply ("Alpha Premultiply", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaToCoverage ("<size=13><b> Alpha To Coverage</b></size>", Float) = 0
+ [ToggleUI]_AlphaSharpenedA2C ("Sharpened A2C--{condition_showS:(_AlphaToCoverage==1)}", Float) = 0
+ _AlphaMipScale ("Mip Level Alpha Scale--{condition_showS:(_AlphaToCoverage==1)}", Range(0, 1)) = 0.25
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDithering ("<size=13><b> Dithering</b></size>", Float) = 0
+ _AlphaDitherGradient ("Dither Gradient--{condition_showS:(_AlphaDithering==1)}", Range(0, 1)) = .1
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaDistanceFade ("<size=13><b> Distance Alpha</b></size>", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)] _AlphaDistanceFadeType ("Pos To Use--{condition_showS:(_AlphaDistanceFade==1)}", Int) = 1
+ _AlphaDistanceFadeMinAlpha ("Min Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 0
+ _AlphaDistanceFadeMaxAlpha ("Max Distance Alpha--{condition_showS:(_AlphaDistanceFade==1)}", Range(0, 1)) = 1
+ _AlphaDistanceFadeMin ("Min Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+ _AlphaDistanceFadeMax ("Max Distance--{condition_showS:(_AlphaDistanceFade==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaFresnel ("<size=13><b> Fresnel Alpha</b></size>", Float) = 0
+ _AlphaFresnelAlpha ("Intensity--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = 0
+ _AlphaFresnelSharpness ("Sharpness--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ _AlphaFresnelWidth ("Width--{condition_showS:(_AlphaFresnel==1)}", Range(0, 1)) = .5
+ [ToggleUI]_AlphaFresnelInvert ("Invert--{condition_showS:(_AlphaFresnel==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _AlphaAngular ("<size=13><b> Angular Alpha</b></size>", Float) = 0
+ [Enum(Camera Face Model, 0, Model Face Camera, 1, Face Each Other, 2)] _AngleType ("Angle Type--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Enum(Model, 0, Vertex, 1)] _AngleCompareTo ("Model or Vert Positon--{condition_showS:(_AlphaAngular==1)}", Int) = 0
+ [Vector3]_AngleForwardDirection ("Forward Direction--{condition_showS:(_AlphaAngular==1)}", Vector) = (0, 0, 1)
+ _CameraAngleMin ("Camera Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _CameraAngleMax ("Camera Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _ModelAngleMin ("Model Angle Min--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 45
+ _ModelAngleMax ("Model Angle Max--{condition_showS:(_AlphaAngular==1)}", Range(0, 180)) = 90
+ _AngleMinAlpha ("Min Alpha--{condition_showS:(_AlphaAngular==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_AlphaAudioLinkEnabled ("<size=13><b> Alpha Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Vector2]_AlphaAudioLinkAddRange ("Add Range--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AlphaAudioLinkAddBand ("Add Band--{ condition_showS:(_AlphaAudioLinkEnabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_Alpha ("Alpha Options", Float) = 0
+
+ [HideInInspector] m_start_DetailOptions ("Details--{reference_property:_DetailEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(FINALPASS)]_DetailEnabled ("Enable", Float) = 0
+ [ThryRGBAPacker(R Texture Mask, G Normal Mask, B Nothing, A Nothing)]_DetailMask ("Detail Mask (Expand)--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DetailMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailMaskUV ("UV", Int) = 0
+ _DetailTint ("Detail Texture 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
+ _DetailTex ("Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}", 2D) = "gray" { }
+ [HideInInspector][Vector2]_DetailTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailTexUV ("UV", Int) = 0
+ _DetailTexIntensity ("Detail Tex Intensity", Range(0, 10)) = 1
+ _DetailBrightness ("Detail Brightness:", Range(0, 2)) = 1
+ [Normal]_DetailNormalMap ("Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV, _DetailNormalMapScale]}", 2D) = "bump" { }
+ [HideInInspector]_DetailNormalMapScale ("Detail Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_DetailNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DetailNormalMapUV ("UV", Int) = 0
+ [HideInInspector] m_end_DetailOptions ("Details", Float) = 0
+
+ [HideInInspector] m_start_vertexManipulation ("Vertex Options--{reference_property:_VertexManipulationsEnabled, button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [HideInInspector][ThryToggle(AUTO_EXPOSURE)]_VertexManipulationsEnabled ("Enabled", Float) = 0
+ [Vector3]_VertexManipulationLocalTranslation ("Local Translation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotation ("Local Rotation", Vector) = (0, 0, 0, 1)
+ [Vector3]_VertexManipulationLocalRotationSpeed ("Local Rotation Speed", Vector) = (0, 0, 0, 1)
+ _VertexManipulationLocalScale ("Local Scale", Vector) = (1, 1, 1, 1)
+ [Vector3]_VertexManipulationWorldTranslation ("World Translation", Vector) = (0, 0, 0, 1)
+ _VertexManipulationHeight ("Vertex Height", Float) = 0
+ _VertexManipulationHeightMask ("Height Map--{reference_properties:[_VertexManipulationHeightMaskPan, _VertexManipulationHeightMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_VertexManipulationHeightMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _VertexManipulationHeightMaskUV ("UV", Int) = 0
+ _VertexManipulationHeightBias ("Mask Bias", Range(0, 1)) = 0
+ [ToggleUI]_VertexRoundingEnabled ("Rounding Enabled", Float) = 0
+ _VertexRoundingDivision ("Rounding Interval", Float) = 0.02
+
+ [Space(10)]
+ [ThryToggleUI(true)]_VertexAudioLinkEnabled ("<size=13><b> Audio Link</b></size>--{condition_showS:(_EnableAudioLink==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalTranslationALBand ("Local Translate Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalTranslationALMin ("Local Translate Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexLocalTranslationALMax ("Local Translate Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandX("Rotation Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandY ("Rotation Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationALBandZ ("Rotation Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationAL ("Rotation--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandX ("Band X--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandY ("Band Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeY ("Motion Type Y--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalRotationCTALBandZ ("Band Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", 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)]_VertexLocalRotationCTALTypeZ ("Motion Type Z--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexLocalRotationCTALSpeed ("Rotation Speed--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexLocalScaleALBand ("Scale Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ _VertexLocalScaleALMin ("Scale Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ _VertexLocalScaleALMax ("Scale Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexWorldTranslationALBand ("World Translation Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector3]_VertexWorldTranslationALMin ("World Translation Min--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Vector3]_VertexWorldTranslationALMax ("World Translation Max--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexManipulationHeightBand ("Vertex Height Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexManipulationHeightAL ("Vertex Height--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [Space(10)]
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _VertexRoundingRangeBand ("Rounding Band--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Int) = 0
+ [Vector2]_VertexRoundingRangeAL ("Rounding Range--{ condition_showS:(_EnableAudioLink==1 && _VertexAudioLinkEnabled==1)}", Vector) = (0,0,0)
+ [HideInInspector] m_end_vertexManipulation ("Vertex Offset", Float) = 0
+
+ [HideInInspector] m_start_MainVertexColors ("Vertex Colors", Float) = 0
+ [ToggleUI]_MainVertexColoringLinearSpace ("Linear Colors", Float) = 1
+ _MainVertexColoring ("Use Vertex Color", Range(0, 1)) = 0
+ _MainUseVertexColorAlpha ("Use Vertex Color Alpha", Range(0, 1)) = 0
+ [HideInInspector] m_end_MainVertexColors ("Vertex Colors", Float) = 0
+
+ // Back Face Textures and Emission
+ [HideInInspector] m_start_backFace ("Back Face--{reference_property:_BackFaceEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(POI_BACKFACE)]_BackFaceEnabled ("Backface Enabled", Float) = 0
+ _BackFaceColor ("Color--{reference_property:_BackFaceColorThemeIndex}", 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)] _BackFaceColorThemeIndex ("", Int) = 0
+ _BackFaceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _BackFaceAlpha ("Alpha", Range(0,1)) = 1
+ _BackFaceTexture ("Texture--{reference_properties:[_BackFaceTexturePan, _BackFaceTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceTextureUV ("UV#", Int) = 0
+ _BackFaceMask ("Mask--{reference_properties:[_BackFaceMaskPan, _BackFaceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BackFaceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BackFaceMaskUV ("UV#", Int) = 0
+ _BackFaceDetailIntensity ("Detail Intensity", Range(0, 5)) = 1
+ [ToggleUI]_BackFaceReplaceAlpha ("Replace Alpha", Float) = 0
+ _BackFaceEmissionLimiter ("Emission Limiter", Range(0,1)) = 1
+ [Space(10)]
+ [ThryToggleUI(true)]_BackFaceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _BackFaceHueShift ("Hue Shift--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _BackFaceHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_BackFaceHueShiftEnabled==1)}", Float) = 0
+ [HideInInspector] m_end_backFace ("Back Face", Float) = 0
+
+ // RGBA Masking
+ [HideInInspector] m_start_RGBMask ("RGBA Color Masking--{reference_property:_RGBMaskEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE)]_RGBMaskEnabled ("RGB Mask Enabled", Float) = 0
+ [ToggleUI]_RGBUseVertexColors ("Use Vertex Colors", Float) = 0
+ [ToggleUI]_RGBBlendMultiplicative ("Multiplicative?", Float) = 0
+ [ThryRGBAPacker(R Mask,G Mask,B Mask,A Mask)]_RGBMask ("Mask--{reference_properties:[_RGBMaskPan, _RGBMaskUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RGBMaskUV ("UV", int) = 0
+ _RedColor ("R Color--{reference_property:_RedColorThemeIndex}", 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)] _RedColorThemeIndex ("", Int) = 0
+ _RedTexture ("R Texture--{reference_properties:[_RedTexturePan, _RedTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RedTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RedTextureUV ("UV", int) = 0
+ _GreenColor ("G Color--{reference_property:_GreenColorThemeIndex}", 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)] _GreenColorThemeIndex ("", Int) = 0
+ _GreenTexture ("G Texture--{reference_properties:[_GreenTexturePan, _GreenTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GreenTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_GreenTextureUV ("UV", int) = 0
+ _BlueColor ("B Color--{reference_property:_BlueColorThemeIndex}", 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)] _BlueColorThemeIndex ("", Int) = 0
+ _BlueTexture ("B Texture--{reference_properties:[_BlueTexturePan, _BlueTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_BlueTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_BlueTextureUV ("UV", int) = 0
+ _AlphaColor ("A Color--{reference_property:_AlphaColorThemeIndex}", 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)] _AlphaColorThemeIndex ("", Int) = 0
+ _AlphaTexture ("A Texture--{reference_properties:[_AlphaTexturePan, _AlphaTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AlphaTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_AlphaTextureUV ("UV", int) = 0
+
+ // RGB MASKED NORMALS
+ [ThryToggle(GEOM_TYPE_MESH)]_RgbNormalsEnabled ("Enable Normals", Float) = 0
+ [ToggleUI]_RGBNormalBlend ("Blend with Base--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Float) = 0
+ [Normal]_RgbNormalR ("R Normal--{reference_properties:[_RgbNormalRPan, _RgbNormalRUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalRUV ("UV", int) = 0
+ _RgbNormalRScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalG ("G Normal--{reference_properties:[_RgbNormalGPan, _RgbNormalGUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalGUV ("UV", int) = 0
+ _RgbNormalGScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalB ("B Normal--{reference_properties:[_RgbNormalBPan, _RgbNormalBUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalBUV ("UV", int) = 0
+ _RgbNormalBScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [Normal]_RgbNormalA ("A Normal--{reference_properties:[_RgbNormalAPan, _RgbNormalAUV],condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_RgbNormalAUV ("UV", int) = 0
+ _RgbNormalAScale ("Intensity--{condition_show:{type:PROPERTY_BOOL,data:_RgbNormalsEnabled==1}}", Range(0, 10)) = 0
+ [HideInInspector] m_end_RGBMask ("RGB Color Masking", Float) = 0
+
+ // Decal Texture
+ [HideInInspector] m_start_DecalSection ("Decals--{button_help:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube}}", Float) = 0
+ [ThryRGBAPacker(Decal 0 Mask, Decal 1 Mask, Decal 2 Mask, Decal 3 Mask)]_DecalMask ("Decal RGBA Mask--{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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalMaskUV ("UV", Int) = 0
+ [ThryToggleUI(true)] _DecalTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _Decal0TPSMaskStrength ("Mask r Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal1TPSMaskStrength ("Mask g Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal2TPSMaskStrength ("Mask b Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ _Decal3TPSMaskStrength ("Mask a Strength--{condition_showS:(_DecalTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ // Decal 0
+ [HideInInspector] m_start_Decal0 ("Decal 0--{reference_property:_DecalEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH)]_DecalEnabled ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal0MaskChannel ("Mask Channel", Int) = 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
+ _DecalEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture ("Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTextureUV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled ("Tiled?", Float) = 0
+ _Decal0Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ _DecalHueShift ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _Decal0HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled==1)}", Float) = 0
+ // Decal 0 Audio Link
+ [HideInInspector] m_start_Decal0AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal0Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal0SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal0SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal0EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal0Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC0 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand0 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType0 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed0 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal0AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal0 ("Decal 0", Float) = 0
+ // Decal 1
+ //"GEOM_TYPE_FROND"
+ //"DEPTH_OF_FIELD_COC_VIEW"
+ [HideInInspector] m_start_Decal1 ("Decal 1--{reference_property:_DecalEnabled1}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_BRANCH_DETAIL)]_DecalEnabled1 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal1MaskChannel ("Mask Channel", Int) = 1
+ _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
+ _DecalEmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture1 ("Decal--{reference_properties:[_DecalTexture1Pan, _DecalTexture1UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture1UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled1 ("Tiled?", Float) = 0
+ _Decal1Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale1 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset1 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition1 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation1 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed1 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType1 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha1 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha1 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled1 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed1 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ _DecalHueShift1 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _Decal1HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled1==1)}", Float) = 0
+ // Decal 1 Audio Link
+ [HideInInspector] m_start_Decal1AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal1Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal1SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal1SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal1EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal1Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC1 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand1 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType1 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed1 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal1AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal1 ("Decal 0", Float) = 0
+ // Decal 2
+ [HideInInspector] m_start_Decal2 ("Decal 2--{reference_property:_DecalEnabled2}", Float) = 0
+ [HideInInspector][ThryToggle(GEOM_TYPE_FROND)]_DecalEnabled2 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal2MaskChannel ("Mask Channel", Int) = 2
+ _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
+ _DecalEmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture2 ("Decal--{reference_properties:[_DecalTexture2Pan, _DecalTexture2UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture2UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled2 ("Tiled?", Float) = 0
+ _Decal2Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale2 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset2 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition2 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation2 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed2 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType2 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha2 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha2 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled2 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed2 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ _DecalHueShift2 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _Decal2HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled2==1)}", Float) = 0
+ // Decal 2 Audio Link
+ [HideInInspector] m_start_Decal2AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal2Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal2SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal2SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal2EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal2Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC2 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand2 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType2 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed2 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal2AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal2 ("Decal 0", Float) = 0
+ // Decal 3
+ [HideInInspector] m_start_Decal3 ("Decal 3--{reference_property:_DecalEnabled3}", Float) = 0
+ [HideInInspector][ThryToggle(DEPTH_OF_FIELD_COC_VIEW)]_DecalEnabled3 ("Enable", Float) = 0
+ [Enum(R, 0, G, 1, B, 2, A, 3)] _Decal3MaskChannel ("Mask Channel", Int) = 3
+ _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
+ _DecalEmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+ _DecalTexture3 ("Decal--{reference_properties:[_DecalTexture3Pan, _DecalTexture3UV]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _DecalTexture3UV ("UV", Int) = 0
+ [ToggleUI]_DecalTiled3 ("Tiled?", Float) = 0
+ _Decal3Depth ("Depth", Float) = 0
+ [Vector2]_DecalScale3 ("Scale", Vector) = (1, 1, 0, 0)
+ _DecalSideOffset3 ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [Vector2]_DecalPosition3 ("Position", Vector) = (.5, .5, 0, 0)
+ _DecalRotation3 ("Rotation", Range(0, 360)) = 0
+ _DecalRotationSpeed3 ("Rotation Speed", Float) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_DecalBlendType3 ("Blending", Range(0, 1)) = 0
+ _DecalBlendAlpha3 ("Alpha", Range(0, 1)) = 1
+ [ToggleUI]_DecalOverrideAlpha3 ("Override Alpha", Float) = 0
+ [ThryToggleUI(true)]_DecalHueShiftEnabled3 ("<size=13><b>Hue Shift</b></size>", Float) = 0
+ _DecalHueShiftSpeed3 ("Shift Speed--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ _DecalHueShift3 ("Hue Shift--{condition_showS:(_DecalHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _Decal3HueAngleStrength ("Hue Angle Power--{condition_showS:(_DecalHueShiftEnabled3==1)}", Float) = 0
+ // Decal 3 Audio Link
+ [HideInInspector] m_start_Decal3AudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3ScaleBand ("Scale Band", Int) = 0
+ _AudioLinkDecal3Scale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3SideBand ("Side Band", Int) = 0
+ _AudioLinkDecal3SideMin ("Side Mod Min", Vector) = (0, 0, 0, 0)
+ _AudioLinkDecal3SideMax ("Side Mod Max", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3RotationBand ("Rotation Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Rotation ("Rotation Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3AlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Alpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDecal3EmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkDecal3Emission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_AudioLinkDecalCC3 ("CC Strip", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DecalRotationCTALBand3 ("Chrono Rotation Band", Int) = 0
+ [ThryWideEnum(Motion increases as intensity of band increases, 0, Above but Smooth, 1, Motion moves back and forth as a function of intensity, 2, Above but Smoooth, 3, Fixed speed increase when the band is dark Stationary when light, 4, Above but Smooooth, 5, Fixed speed increase when the band is dark Fixed speed decrease when light, 6, Above but Smoooooth, 7)]_DecalRotationCTALType3 ("Chrono Motion Type", Int) = 0
+ _DecalRotationCTALSpeed3 ("Chrono Rotation Speed", Float) = 0
+ [HideInInspector] m_end_Decal3AudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Decal3 ("Decal 0", Float) = 0
+ [HideInInspector] m_end_DecalSection ("Decal", Float) = 0
+
+ [HideInInspector] m_start_GlobalThemes ("Global Themes", Float) = 0
+ [HDR]_GlobalThemeColor0 ("Color 0", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor1 ("Color 1", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor2 ("Color 2", Color) = (1, 1, 1, 1)
+ [HDR]_GlobalThemeColor3 ("Color 3", Color) = (1, 1, 1, 1)
+ [HideInInspector] m_end_GlobalThemes ("Global Themes", Float) = 0
+
+ // Lighting
+ [HideInInspector] m_lightingCategory ("Shading", Float) = 0
+
+ [HideInInspector] m_start_PoiLightData ("Light Data ", Float) = 0
+ // Lighting Data
+ _LightingAOMaps ("AO Maps (expand)--{reference_properties:[_LightingAOMapsPan, _LightingAOMapsUV,_LightDataAOStrengthR,_LightDataAOStrengthG,_LightDataAOStrengthB,_LightDataAOStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingAOMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingAOMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightDataAOStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightDataAOStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightDataAOStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingDetailShadowMaps ("Detail Shadows (expand)--{reference_properties:[_LightingDetailShadowMapsPan, _LightingDetailShadowMapsUV,_LightingDetailShadowStrengthR,_LightingDetailShadowStrengthG,_LightingDetailShadowStrengthB,_LightingDetailShadowStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingDetailShadowMapsPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingDetailShadowMapsUV ("UV", Int) = 0
+ [HideInInspector]_LightingDetailShadowStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingDetailShadowStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingDetailShadowStrengthA ("A Strength", Range(0, 1)) = 0
+ _LightingShadowMasks ("Shadow Masks (expand)--{reference_properties:[_LightingShadowMasksPan, _LightingShadowMasksUV,_LightingShadowMaskStrengthR,_LightingShadowMaskStrengthG,_LightingShadowMaskStrengthB,_LightingShadowMaskStrengthA]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_LightingShadowMasksPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _LightingShadowMasksUV ("UV", Int) = 0
+ [HideInInspector]_LightingShadowMaskStrengthR ("R Strength", Range(0, 1)) = 1
+ [HideInInspector]_LightingShadowMaskStrengthG ("G Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthB ("B Strength", Range(0, 1)) = 0
+ [HideInInspector]_LightingShadowMaskStrengthA ("A Strength", Range(0, 1)) = 0
+ // Base Pass
+ [Space(15)]
+ [ThryHeaderLabel(Base Pass Lighting, 13)]
+ [Space(4)]
+ [Enum(Poi Custom, 0, Standard, 1, UTS2, 2)] _LightingColorMode ("Light Color Mode", Int) = 0
+ [Enum(Poi Custom, 0, Normalized NDotL, 1, Saturated NDotL, 2)] _LightingMapMode ("Light Map Mode", Int) = 0
+ [Enum(Poi Custom, 0, Forced Local Direction, 1, Forced World Direction, 2, UTS2, 3)] _LightingDirectionMode ("Light Direction Mode", Int) = 0
+ [Vector3]_LightngForcedDirection ("Forced Direction--{condition_showS:(_LightingDirectionMode==1 || _LightingDirectionMode==2)}", Vector) = (0, 0, 0)
+ [ToggleUI]_LightingForceColorEnabled ("Force Light Color", Float) = 0
+ _LightingForcedColor ("Forced Color--{condition_showS:(_LightingForceColorEnabled==1), reference_property:_LightingForcedColorThemeIndex}", 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)] _LightingForcedColorThemeIndex ("", Int) = 0
+ _Unlit_Intensity ("Unlit_Intensity--{condition_showS:(_LightingColorMode==2)}", Range(0.001, 4)) = 1
+ [ToggleUI]_LightingCapEnabled ("Limit Brightness", Float) = 1
+ _LightingCap ("Max Brightness--{condition_showS:(_LightingCapEnabled==1)}", Range(0, 10)) = 1
+ _LightingMinLightBrightness ("Min Brightness", Range(0, 1)) = 0
+ _LightingIndirectUsesNormals ("Indirect Uses Normals--{condition_showS:(_LightingColorMode==0)}", Range(0, 1)) = 0
+ _LightingCastedShadows ("Receive Casted Shadows", Range(0, 1)) = 0
+ _LightingMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ // Lighting Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_ENABLE)]_LightingAdditiveEnable ("Enable Additive", Float) = 1
+ [ThryToggle(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE)]_DisableDirectionalInAdd ("Ignore Directional--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 1
+ [ToggleUI]_LightingAdditiveLimited ("Limit Brightness?--{condition_showS:(_LightingAdditiveEnable==1)}", Float) = 0
+ _LightingAdditiveLimit ("Max Brightness--{ condition_showS:(_LightingAdditiveLimited==1&&_LightingAdditiveEnable==1)}", Range(0, 10)) = 1
+ _LightingAdditiveMonochromatic ("Grayscale Lighting?", Range(0, 1)) = 0
+ _LightingAdditivePassthrough ("Point Light Passthrough--{condition_showS:(_LightingAdditiveEnable==1)}", Range(0, 1)) = .5
+ // Vertex Lighting
+ [Space(15)]
+ [ThryHeaderLabel(Vertex Lighting, 13)]
+ [Space(4)]
+ [ThryToggle(POI_VERTEXLIGHT_ON)]_LightingVertexLightingEnabled ("Enabled", Float) = 1
+ // Lighting Data Debug
+ [Space(15)]
+ [ThryHeaderLabel(Debug Visualization, 13)]
+ [Space(4)]
+ [ThryToggle(POI_LIGHT_DATA_DEBUG)]_LightDataDebugEnabled ("Debug", Float) = 0
+ [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--{condition_showS:(_LightDataDebugEnabled==1)}", Int) = 0
+
+ [HideInInspector] m_end_PoiLightData ("Light Data", Float) = 0
+
+ [HideInInspector] m_start_PoiShading (" Shading--{reference_property:_ShadingEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(VIGNETTE_MASKED)]_ShadingEnabled ("Enable Shading", Float) = 1
+ [ThryHeaderLabel(Base Pass Shading, 13)]
+ [Space(4)]
+ [KeywordEnum(TextureRamp, Multilayer Math, Wrapped, Skin, ShadeMap, Flat, Realistic, Cloth)] _LightingMode ("Lighting Type", Float) = 5
+ _LightingShadowColor ("Shadow Tint--{condition_showS:(_LightingMode!=4 && _LightingMode!=1 && _LightingMode!=5)}", Color) = (1, 1, 1)
+ [Gradient]_ToonRamp ("Lighting Ramp--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true,condition_showS:(_LightingMode==0)}", 2D) = "white" { }
+ _ShadowOffset ("Ramp Offset--{condition_showS:(_LightingMode==0)}", Range(-1, 1)) = 0
+ _LightingWrappedWrap ("Wrap--{condition_showS:(_LightingMode==2)}", Range(0, 2)) = 0
+ _LightingWrappedNormalization ("Normalization--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+
+ // 2 layer shadow with border color
+ _ShadowColorTex ("Shadow Color--{reference_properties:[_ShadowColorTexPan, _ShadowColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_ShadowColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ShadowColorTexUV ("UV", Int) = 0
+ _ShadowColor ("Shadow Color--{condition_showS:(_LightingMode==1)}", Color) = (0.7, 0.75, 0.85, 1.0)
+ //_ShadowNormalStrength ("Normal Strength", Range(0, 1)) = 1.0
+ _ShadowBorder ("Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _ShadowBlur ("Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _Shadow2ndColorTex ("2nd Color--{reference_properties:[_Shadow2ndColorTexPan, _Shadow2ndColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow2ndColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow2ndColorTexUV ("UV", Int) = 0
+ _Shadow2ndColor ("2nd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow2ndNormalStrength ("2nd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow2ndBorder ("2nd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.5
+ _Shadow2ndBlur ("2nd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.3
+ _Shadow3rdColorTex ("3rd Color--{reference_properties:[_Shadow3rdColorTexPan, _Shadow3rdColorTexUV], condition_showS:(_LightingMode==1)}", 2D) = "black" { }
+ [HideInInspector][Vector2]_Shadow3rdColorTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Shadow3rdColorTexUV ("UV", Int) = 0
+ _Shadow3rdColor ("3rd Color--{condition_showS:(_LightingMode==1)}", Color) = (0, 0, 0, 0)
+ //_Shadow3rdNormalStrength ("3rd Normal Strength", Range(0, 1)) = 1.0
+ _Shadow3rdBorder ("3rd Border--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.25
+ _Shadow3rdBlur ("3rd Blur--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0.1
+ _ShadowBorderColor ("Border Color--{condition_showS:(_LightingMode==1)}", Color) = (1, 0, 0, 1)
+ _ShadowBorderRange ("Border Range--{condition_showS:(_LightingMode==1)}", Range(0, 1)) = 0
+ //wrapped
+ _LightingGradientStart ("Gradient Start--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = 0
+ _LightingGradientEnd ("Gradient End--{condition_showS:(_LightingMode==2)}", Range(0, 1)) = .5
+
+ // Shade Maps
+ _1st_ShadeColor ("1st ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1)
+ _1st_ShadeMap ("1st ShadeMap--{reference_properties:[_1st_ShadeMapPan, _1st_ShadeMapUV, _Use_1stShadeMapAlpha_As_ShadowMask, _1stShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_1st_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _1st_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_1stShadeMapAlpha_As_ShadowMask ("1st ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_1stShadeMapMask_Inverse ("1st ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_BaseAs1st ("Use BaseMap as 1st ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _2nd_ShadeColor ("2nd ShadeColor--{condition_showS:(_LightingMode==4)}", Color) = (1, 1, 1, 1)
+ _2nd_ShadeMap ("2nd ShadeMap--{reference_properties:[_2nd_ShadeMapPan, _2nd_ShadeMapUV, _Use_2ndShadeMapAlpha_As_ShadowMask, _2ndShadeMapMask_Inverse],condition_showS:(_LightingMode==4)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_2nd_ShadeMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _2nd_ShadeMapUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Use_2ndShadeMapAlpha_As_ShadowMask ("2nd ShadeMap.a As ShadowMask", Float) = 0
+ [HideInInspector][ToggleUI]_2ndShadeMapMask_Inverse ("2nd ShadeMapMask Inverse", Float) = 0
+ [ToggleUI] _Use_1stAs2nd ("Use 1st ShadeMap as 2nd_ShadeMap--{condition_showS:(_LightingMode==4)}", Float) = 0
+ _BaseColor_Step ("BaseColor_Step--{condition_showS:(_LightingMode==4)}", Range(0.01, 1)) = 0.5
+ _BaseShade_Feather ("Base/Shade_Feather--{condition_showS:(_LightingMode==4)}", Range(0.0001, 1)) = 0.0001
+ _ShadeColor_Step ("ShadeColor_Step--{condition_showS:(_LightingMode==4)}", Range(0, 1)) = 0
+ _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
+
+ // Skin Shading
+ _SkinLUT ("LUT--{condition_showS:(_LightingMode==3)}", 2D) = "white" { }
+ _SssScale ("Scale--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 1
+ [HideInInspector]_SssBumpBlur ("Bump Blur--{condition_showS:(_LightingMode==3)}", Range(0, 1)) = 0.7
+ [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)
+ // Cloth
+ [NonModifiableTextureData] [NoScaleOffset] _ClothDFG ("MultiScatter Cloth DFG--{condition_showS:(_LightingMode==7)}", 2D) = "black" { }
+ [ThryRGBAPacker(Metallic Map, Cloth Mask, Reflectance, Smoothness)]_ClothMetallicSmoothnessMap ("Maps (Expand)--{reference_properties:[_ClothMetallicSmoothnessMapPan, _ClothMetallicSmoothnessMapUV, _ClothMetallicSmoothnessMapInvert],condition_showS:(_LightingMode==7)}", 2D) = "white" { }
+ [HideInInspector][Vector2] _ClothMetallicSmoothnessMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI] _ClothMetallicSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ClothMetallicSmoothnessMapUV ("UV", Int) = 0
+ //[ThryToggle(POI_CLOTHLERP)] _ClothLerp ("Clothmask Lerp--{condition_showS:(_LightingMode==7)}", Float) = 0
+ //[Gamma] _ClothMetallic ("Metallic--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0
+ _ClothReflectance ("Reflectance--{condition_showS:(_LightingMode==7)}", Range(0.35, 1)) = 0.5
+ _ClothSmoothness ("Smoothness--{condition_showS:(_LightingMode==7)}", Range(0, 1)) = 0.5
+
+ // SDF
+ /*
+ _SDFShadingTexture ("LUT--{reference_properties:[_SDFShadingTexturePan, _SDFShadingTextureUV],condition_showS:(_LightingMode==8)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_SDFShadingTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _SDFShadingTextureUV ("UV", Int) = 0
+ */
+ // Generic
+ _ShadowStrength ("Shadow Strength--{condition_showS:(_LightingMode<=4)}", Range(0, 1)) = 1
+ _LightingIgnoreAmbientColor ("Ignore Ambient Color--{condition_showS:(_LightingMode<=3)}", Range(0, 1)) = 0
+
+ // Additive
+ [Space(15)]
+ [ThryHeaderLabel(Add Pass Shading, 13)]
+ [Space(4)]
+ [Enum(Realistic, 0, Toon, 1)] _LightingAdditiveType ("Lighting Type", Int) = 1
+ _LightingAdditiveGradientStart ("Gradient Start--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = 0
+ _LightingAdditiveGradientEnd ("Gradient End--{condition_showS:(_LightingAdditiveType==1)}", Range(0, 1)) = .5
+ //_LightingAdditiveDetailStrength ("Detail Shadow Strength", Range(0, 1)) = 1 //TODO-implement this
+
+ [HideInInspector] m_end_PoiShading ("Shading", Float) = 0
+
+ [HideInInspector] m_start_Aniso (" Anisotropics--{reference_property:_EnableAniso}", Float) = 0
+
+ [HideInInspector][ThryToggle(POI_ANISOTROPICS)]_EnableAniso ("Enable Aniso", Float) = 0
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_AnisoColorMap ("Color & Offset--{reference_properties:[_AnisoColorMapPan, _AnisoColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_AnisoColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoColorMapUV ("UV", Int) = 0
+ /*
+ _AnisoNoiseMap ("Noise Map--{reference_properties:[_AnisoNoiseMapPan, _AnisoNoiseMapUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_AnisoNoiseMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _AnisoNoiseMapUV ("UV", Int) = 0
+ */
+ _AnisoUseLightColor ("Mix Light Color", Range(0, 1)) = 1
+ _AnisoUseBaseColor ("Mix Base Color", Range(0, 1)) = 0
+ _AnisoReplace ("Replace Blending", Range(0, 1)) = 0
+ _AnisoAdd ("Add Blending", Range(0, 1)) = 1
+ _AnisoHideInShadow ("Hide In Shadow", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Top Layer, 13)]
+ _Aniso0Power ("Power", Range(0, 1)) = 0
+ _Aniso0Strength ("Strength", Range(0, 1)) = 1
+ _Aniso0Offset ("Offset", Range(-10, 10)) = 0
+ _Aniso0OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso0Tint ("Tint--{reference_property:_Aniso0TintIndex}", 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)] _Aniso0TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso0ToonMode ("Toon Mode", Float) = 0
+ _Aniso0Edge ("Edge--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso0Blur ("Blur--{condition_showS:(_Aniso0ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryHeaderLabel(Bottom Layer, 13)]
+ _Aniso1Power ("Power", Range(0, 1)) = .1
+ _Aniso1Strength ("Strength", Range(0, 1)) = 1
+ _Aniso1Offset ("Offset", Range(-1, 1)) = 0
+ _Aniso1OffsetMapStrength ("Map Offset Strength", Range(0, 1)) = 0
+ _Aniso1Tint ("Tint--{reference_property:_Aniso1TintIndex}", 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)] _Aniso1TintIndex ("", Int) = 0
+ [ThryToggleUI(true)] _Aniso1ToonMode ("Toon Mode", Float) = 0
+ _Aniso1Edge ("Edge--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = .5
+ _Aniso1Blur ("Blur--{condition_showS:(_Aniso1ToonMode==1)}", Range(0, 1)) = 0
+
+ [Space(4)]
+ [ThryToggle(POI_ANISOTROPICS_DEBUG)]_AnisoDebugToggle ("Debug", Float) = 0
+ [ThryWideEnum(Off, 0, Overall Specular, 1, Specular 0, 2, Specular 1, 3)] _AnisoDebugMode ("Visualize--{condition_showS:(_AnisoDebugToggle==1)}", Int) = 0
+
+ [HideInInspector] m_end_Ansio ("Anisotropics", Float) = 0
+
+ // First Matcap
+ [HideInInspector] m_start_matcap ("Matcap 0--{reference_property:_MatcapEnable}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MATCAP0)]_MatcapEnable ("Enable Matcap", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _MatcapUVMode ("UV Mode", Int) = 1
+ _MatcapColor ("Color--{reference_property:_MatcapColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _MatcapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap ("Matcap", 2D) = "white" { }
+ _MatcapBorder ("Border", Range(0, .5)) = 0.43
+ _MatcapMask ("Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV, _MatcapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_MatcapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MatcapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MatcapMaskInvert ("Invert", Float) = 0
+ _MatcapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _MatcapIntensity ("Intensity", Range(0, 5)) = 1
+ _MatcapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _MatcapReplace ("Replace Blend", Range(0, 1)) = 1
+ _MatcapMultiply ("Multiply Blend", Range(0, 1)) = 0
+ _MatcapAdd ("Add Blend", Range(0, 1)) = 0
+ _MatcapMixed ("Mixed Blend", Range(0, 1)) = 0
+ _MatcapAddToLight ("Add To Light", Range(0, 1)) = 0
+ _MatcapAlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _MatcapNormal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP0_CUSTOM_NORMAL, true)] _Matcap0CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [Normal]_Matcap0NormalMap ("Normal Map--{reference_properties:[_Matcap0NormalMapPan, _Matcap0NormalMapUV, _Matcap0NormalMapScale], condition_showS:(_Matcap0CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap0NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap0NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap0NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _MatcapHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _MatcapHueShiftSpeed ("Shift Speed--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+ _MatcapHueShift ("Hue Shift--{condition_showS:(_MatcapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _MatcapTPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _MatcapTPSMaskStrength ("TPS Mask Strength--{condition_showS:(_MatcapTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_matcap ("Matcap--{condition_showS:(_MatcapHueShiftEnabled==1)}", Float) = 0
+
+ // Second Matcap
+ [HideInInspector] m_start_Matcap2 ("Matcap 1--{reference_property:_Matcap2Enable}", Float) = 0
+ [HideInInspector][ThryToggle(COLOR_GRADING_HDR_3D)]_Matcap2Enable ("Enable Matcap 2", Float) = 0
+ [ThryWideEnum(UTS Style, 0, Top Pinch, 1, Double Sided, 2)] _Matcap2UVMode ("UV Mode", Int) = 1
+ _Matcap2Color ("Color--{reference_property:_Matcap2ColorThemeIndex}", Color) = (1, 1, 1, 1)
+ [HideInInspector][ThryWideEnum(Off, 0, Theme Color 0, 1, Theme Color 1, 2, Theme Color 2, 3, Theme Color 3, 4, ColorChord 0, 5, ColorChord 1, 6, ColorChord 2, 7, ColorChord 3, 8, AL Theme 0, 9, AL Theme 1, 10, AL Theme 2, 11, AL Theme 3, 12)] _Matcap2ColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_Matcap2 ("Matcap", 2D) = "white" { }
+ _Matcap2Border ("Border", Range(0, .5)) = 0.43
+ _Matcap2Mask ("Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV, _Matcap2MaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_Matcap2MaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap2MaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_Matcap2MaskInvert ("Invert", Float) = 0
+ _Matcap2EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _Matcap2Intensity ("Intensity", Range(0, 5)) = 1
+ _Matcap2LightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _Matcap2Replace ("Replace Blend", Range(0, 1)) = 0
+ _Matcap2Multiply ("Multiply Blend", Range(0, 1)) = 0
+ _Matcap2Add ("Add Blend", Range(0, 1)) = 0
+ _Matcap2Mixed ("Mixed Blend", Range(0, 1)) = 0
+ _Matcap2AddToLight ("Add To Light", Range(0, 1)) = 0
+ _Matcap2AlphaOverride ("Override Alpha", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _Matcap2Normal ("Normal to use", Int) = 1
+ [ThryToggle(POI_MATCAP1_CUSTOM_NORMAL, true)] _Matcap1CustomNormal ("<size=13><b> Custom Normal</b></size>", Float) = 0
+ [ThryToggle()]_Matcap1CustomNormal ("Custom Normal", Float) = 0
+ [Normal]_Matcap1NormalMap ("Normal Map--{reference_properties:[_Matcap1NormalMapPan, _Matcap1NormalMapUV, _Matcap1NormalMapScale], condition_showS:(_Matcap1CustomNormal==1)}", 2D) = "bump" { }
+ [HideInInspector][Vector2]_Matcap1NormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _Matcap1NormalMapUV ("UV", Int) = 0
+ [HideInInspector]_Matcap1NormalMapScale ("Intensity", Range(0, 10)) = 1
+ [ThryToggleUI(true)] _Matcap2HueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _Matcap2HueShiftSpeed ("Shift Speed--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+ _Matcap2HueShift ("Hue Shift--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Range(0, 1)) = 0
+ [ThryToggleUI(true)] _Matcap2TPSDepthEnabled ("<size=13><b> TPS Depth Mask Enabled</b></size>", Float) = 0
+ _Matcap2TPSMaskStrength ("TPS Mask Strength--{condition_showS:(_Matcap2TPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_Matcap2 ("Matcap 2--{condition_showS:(_Matcap2HueShiftEnabled==1)}", Float) = 0
+
+ // First CubeMap
+ [HideInInspector] m_start_CubeMap ("CubeMap--{reference_property:_CubeMapEnabled}", Float) = 0
+ [HideInInspector][ThryToggle(_CUBEMAP)]_CubeMapEnabled ("Enable CubeMap", Float) = 0
+ [ThryWideEnum(Skybox, 0, Reflection, 1)] _CubeMapUVMode ("UV Mode", Int) = 1
+ _CubeMapColor ("Color--{reference_property:_CubeMapColorThemeIndex}", 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)] _CubeMapColorThemeIndex ("", Int) = 0
+ [TextureNoSO]_CubeMap ("CubeMap", Cube) = "" { }
+ _CubeMapMask ("Mask--{reference_properties:[_CubeMapMaskPan, _CubeMapMaskUV, _CubeMapMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_CubeMapMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _CubeMapMaskUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_CubeMapMaskInvert ("Invert", Float) = 0
+ _CubeMapEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _CubeMapIntensity ("Color Strength", Range(0, 5)) = 1
+ _CubeMapLightMask ("Hide in Shadow", Range(0, 1)) = 0
+ _CubeMapReplace ("Replace With CubeMap", Range(0, 1)) = 1
+ _CubeMapMultiply ("Multiply CubeMap", Range(0, 1)) = 0
+ _CubeMapAdd ("Add CubeMap", Range(0, 1)) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _CubeMapNormal ("Normal to use", Int) = 1
+
+ [Space(10)]
+ [ThryHeaderLabel(Hue Shift, 13)]
+ [Space(4)]
+ [ToggleUI]_CubeMapHueShiftEnabled ("Enabled", Float) = 0
+ _CubeMapHueShiftSpeed ("Shift Speed--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Float) = 0
+ _CubeMapHueShift ("Hue Shift--{condition_showS:(_CubeMapHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_CubeMap ("CubeMap", Float) = 0
+
+ // Rim Lighting
+ [HideInInspector] m_start_rimLightOptions ("Rim Lighting--{reference_property:_EnableRimLighting}", Float) = 0
+ [HideInInspector][ThryToggle(_GLOSSYREFLECTIONS_OFF)]_EnableRimLighting ("Enable Rim Lighting", Float) = 0
+ [KeywordEnum(Poiyomi, UTS2)] _RimStyle ("Style", Float) = 0
+ _RimTex ("Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV], condition_showS:_RimStyle==0}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimTexPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimTexUV ("UV", Int) = 0
+ _RimMask ("Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV], 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _RimMaskUV ("UV", Int) = 0
+ _Is_NormalMapToRimLight ("Normal Strength", Range(0, 1)) = 1
+ [ToggleUI]_RimLightingInvert ("Invert Rim Lighting--{ condition_showS:_RimStyle==0}", Float) = 0
+ _RimLightColor ("Rim Color--{reference_property:_RimLightColorThemeIndex}", 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)] _RimLightColorThemeIndex ("", Int) = 0
+ _RimWidth ("Rim Width--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0.8
+ _RimSharpness ("Rim Sharpness--{ condition_showS:_RimStyle==0}", Range(0, 1)) = .25
+ _RimPower ("Rim Power--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+ _RimStrength ("Rim Emission--{ condition_showS:_RimStyle==0}", Range(0, 20)) = 0
+ _RimBaseColorMix ("Mix Base Color--{ condition_showS:_RimStyle==0}", Range(0, 1)) = 0
+ [ThryWideEnum(Add, 0, Replace, 1, Multiply, 2, Mixed, 3)] _RimBlendMode ("Blend Mode--{ condition_showS:_RimStyle==0}", Int) = 0
+ _RimBlendStrength ("Blend Strength--{ condition_showS:_RimStyle==0}", Range(0, 10)) = 1
+
+ _Is_LightColor_RimLight ("Mix Light Color--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 1
+ _RimLight_Power ("Rim Power--{ condition_showS:_RimStyle==1}", Range(0, 1)) = 0.1
+ _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
+ [ThryToggleUI(true)] _LightDirection_MaskOn ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==1}", Float) = 0
+ _Tweak_LightDirection_MaskLevel ("Light Dir Mask Level--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(0, 0.5)) = 0
+ [ThryToggleUI(true)] _Add_Antipodean_RimLight ("<size=13><b> Antipodean(Ap) Rim</b></size>--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Float) = 0
+ _Is_LightColor_Ap_RimLight ("Ap Light Color Mix--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 1
+ _Ap_RimLightColor ("Ap Color--{reference_property:_RimApColorThemeIndex, condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", 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)] _RimApColorThemeIndex ("", Int) = 0
+ _Ap_RimLight_Power ("Ap Power--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Range(0, 1)) = 0.1
+ [Toggle(_)] _Ap_RimLight_FeatherOff ("Ap Feather Off--{ condition_showS:_LightDirection_MaskOn==1&&_Add_Antipodean_RimLight==1&&_RimStyle==1}", Float) = 0
+ _Set_RimLightMask ("Set_RimLightMask--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", 2D) = "white" { }
+ _Tweak_RimLightMaskLevel ("Tweak_RimLightMaskLevel--{ condition_showS:_LightDirection_MaskOn==1&&_RimStyle==1}", Range(-1, 1)) = 0
+
+ [ThryToggleUI(true)] _RimShadowToggle ("<size=13><b> Light Direction Mask</b></size>--{ condition_showS:_RimStyle==0}", Float) = 0
+ [Enum(Shadow Map, 0, Custom, 1)]_RimShadowMaskRampType ("Light Falloff Type--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Int) = 0
+ _RimShadowMaskStrength ("Shadow Mask Strength--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 1
+ [MultiSlider]_RimShadowAlpha ("Hide In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1&&_RimShadowMaskRampType==1}", Vector) = (0.0, 0.0, 0, 1)
+ _RimShadowWidth ("Shrink In Shadow--{ condition_showS:_RimStyle==0&&_RimShadowToggle==1}", Range(0, 1)) = 0
+
+ [ThryToggleUI(true)] _RimHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _RimHueShiftSpeed ("Shift Speed--{condition_showS:(_RimHueShiftEnabled==1)}", Float) = 0
+ _RimHueShift ("Hue Shift--{condition_showS:(_RimHueShiftEnabled==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_start_RimAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimWidthBand ("Width Add Band", Int) = 0
+ [Vector2] _AudioLinkRimWidthAdd ("Width Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimEmissionBand ("Emission Add Band", Int) = 0
+ [Vector2] _AudioLinkRimEmissionAdd ("Emission Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkRimBrightnessBand ("Brightness Band", Int) = 0
+ [Vector2] _AudioLinkRimBrightnessAdd ("Brightness Add (XMin, YMax)", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_RimAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_rimLightOptions ("Rim Lighting", Float) = 0
+
+ [HideInInspector] m_start_brdf ("Reflections & Specular--{reference_property:_MochieBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(MOCHIE_PBR)]_MochieBRDF ("Enable", Float) = 0
+ _MochieReflectionStrength ("Reflection Strength", Range(0, 1)) = 1
+ _MochieSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _MochieMetallicMultiplier ("Metallic", Range(0, 1)) = 0
+ _MochieRoughnessMultiplier ("Smoothness", Range(0, 1)) = 1
+ _MochieReflectionTint ("Reflection Tint--{reference_property:_MochieReflectionTintThemeIndex}", 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)] _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
+ [Space(8)]
+ [ThryRGBAPacker(R Metallic Map, G Smoothness Map, B Reflection Mask, A Specular Mask)]_MochieMetallicMaps ("Maps [Expand]--{reference_properties:[_MochieMetallicMapsPan, _MochieMetallicMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_MochieMetallicMapInvert ("Invert Metallic", Float) = 0
+ [HideInInspector][ToggleUI]_MochieRoughnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_MochieReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_MochieSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [ThryToggleUI(true)]_PBRSplitMaskSample ("<size=13><b> Split Mask Sampling</b></size>", Float) = 0
+ _PBRMaskScaleTiling ("ScaleXY TileZW--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (1, 1, 0, 0)
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_MochieMetallicMasksUV ("UV--{condition_showS:(_PBRSplitMaskSample==1)}", Int) = 0
+ [Vector2]_MochieMetallicMasksPan ("Panning--{condition_showS:(_PBRSplitMaskSample==1)}", Vector) = (0, 0, 0, 0)
+ [ThryToggleUI(true)]_Specular2ndLayer ("<size=13><b> 2nd Specular</b></size>", Float) = 0
+ _MochieSpecularStrength2 ("Strength--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ _MochieRoughnessMultiplier2 ("Smoothness--{condition_showS:(_Specular2ndLayer==1)}", Range(0, 1)) = 1
+ [ThryToggleUI(true)] _BRDFTPSDepthEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _BRDFTPSReflectionMaskStrength ("Reflection Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ _BRDFTPSSpecularMaskStrength ("Specular Mask Strength--{condition_showS:(_BRDFTPSDepthEnabled==1)}", Range(0, 1)) = 1
+ [ToggleUI]_IgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_MochieReflCube ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_MochieForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_MochieLitFallback ("Lit Fallback", Float) = 0
+ [ThryToggleUI(true)]_MochieGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _PoiGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _PoiGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ _RefSpecFresnel ("Fresnel Reflection", Range(0, 1)) = 1
+ [HideInInspector] m_end_brdf ("", Float) = 0
+
+ [HideInInspector] m_start_clearCoat ("Clear Coat--{reference_property:_ClearCoatBRDF}", Float) = 0
+ [HideInInspector][ThryToggle(POI_CLEARCOAT)]_ClearCoatBRDF ("Enable", Float) = 0
+ _ClearCoatStrength ("ClearCoat Strength", Range(0, 1)) = 1
+ _ClearCoatSmoothness ("Smoothness", Range(0, 1)) = 1
+ _ClearCoatReflectionStrength ("Reflections Strength", Range(0, 1)) = 1
+ _ClearCoatSpecularStrength ("Specular Strength", Range(0, 1)) = 1
+ _ClearCoatReflectionTint ("Reflection Tint--{reference_property:_ClearCoatReflectionTintThemeIndex}", 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)] _ClearCoatReflectionTintThemeIndex ("", Int) = 0
+ _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)]
+ [ThryRGBAPacker(ClearCoat Mask, Smoothness Map, Reflection Mask, Specular Mask)]_ClearCoatMaps ("Maps [Expand]--{reference_properties:[_ClearCoatMapsPan, _ClearCoatMapsUV, _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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_ClearCoatMapsUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_ClearCoatMaskInvert ("Invert ClearCoat Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSmoothnessMapInvert ("Invert Smoothness", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatReflectionMaskInvert ("Invert Reflection Mask", Float) = 0
+ [HideInInspector][ToggleUI]_ClearCoatSpecularMaskInvert ("Invert Specular Mask", Float) = 0
+ [Space(8)]
+ [ThryTexture][NoScaleOffset]_ClearCoatFallback ("Fallback Cubemap", Cube) = "" { }
+ [ToggleUI]_ClearCoatForceFallback ("Force Fallback", Int) = 0
+ [ToggleUI]_ClearCoatLitFallback ("Lit Fallback", Float) = 0
+ [ToggleUI]_CCIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [ThryToggleUI(true)]_ClearCoatGSAAEnabled ("<size=13><b> GSAA</b></size>", Float) = 1
+ _ClearCoatGSAAVariance ("GSAA Variance", Range(0, 1)) = 0.15
+ _ClearCoatGSAAThreshold ("GSAA Threshold", Range(0, 1)) = 0.1
+ [ThryToggleUI(true)] _ClearCoatTPSDepthMaskEnabled ("<size=13><b> TPS Depth Enabled</b></size>", Float) = 0
+ _ClearCoatTPSMaskStrength ("Mask Strength--{condition_showS:(_ClearCoatTPSDepthMaskEnabled==1)}", Range(0, 1)) = 1
+ [HideInInspector] m_end_clearCoat ("", Float) = 0
+
+ [HideInInspector] m_start_reflectionRim ("Environmental Rim--{reference_property:_EnableEnvironmentalRim}", Float) = 0
+ [HideInInspector][ThryToggle(POI_ENVIRORIM)]_EnableEnvironmentalRim ("Enable", Float) = 0
+ _RimEnviroMask ("Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_RimEnviroMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_RimEnviroMaskUV ("UV", Int) = 0
+ _RimEnviroBlur ("Blur", Range(0, 1)) = 0.7
+ _RimEnviroWidth ("Rim Width", Range(0, 1)) = 0.45
+ _RimEnviroSharpness ("Rim Sharpness", Range(0, 1)) = 0
+ _RimEnviroMinBrightness ("Min Brightness Threshold", Range(0, 2)) = 0
+ _RimEnviroIntensity ("Intensity", Range(0, 1)) = 1
+ [HideInInspector] m_end_reflectionRim ("", Float) = 0
+
+ [HideInInspector] m_start_stylizedSpec (" Stylized Specular--{reference_property:_StylizedSpecular}", Float) = 0
+ [HideInInspector][ThryToggle(POI_STYLIZED_StylizedSpecular)]_StylizedSpecular ("Enable", Float) = 0
+
+ [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 XZ, 5, 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
+ _Set_HighColorMask ("Mask--{reference_properties:[_Set_HighColorMaskPan, _Set_HighColorMaskUV, _Tweak_HighColorMaskLevel]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_Set_HighColorMaskUV ("UV", Int) = 0
+ [HideInInspector]_Tweak_HighColorMaskLevel ("Mask Level", Range(-1, 1)) = 0
+ [ThryWideEnum(Toon, 0, Realistic, 1)]_Is_SpecularToHighColor ("Specular Mode", Float) = 0
+ [ThryWideEnum(Replace, 0, Add, 1)]_Is_BlendAddToHiColor ("Color Blend Mode", Int) = 0
+
+ _StylizedSpecularStrength ("Strength", Float) = 1
+ [ToggleUI] _UseLightColor ("Use Light Color", Float) = 1
+ [ToggleUI]_SSIgnoreCastedShadows ("Ignore Casted Shadows", Float) = 0
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 1, 13)]
+ _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
+ [Space(8)]
+
+ [ThryHeaderLabel(Layer 2, 13)]
+ _Layer2Size ("Size", Range(0, 1)) = 0
+ _StylizedSpecular2Feather ("Feather--{condition_showS:(_Is_SpecularToHighColor==0)}", Range(0, 1)) = 0
+ _Layer2Strength ("Strength", Range(0, 1)) = 0
+ [HideInInspector] m_end_stylizedSpec ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_specialFXCategory ("Special FX", Float) = 0
+ // SPECIALFX_PROPERTIES
+
+ // UDIM Discard
+ [HideInInspector] m_start_udimdiscardOptions ("UDIM Discard--{reference_property:_EnableUDIMDiscardOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_UDIMDISCARD)]_EnableUDIMDiscardOptions ("Enable UDIM Discard Options", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)]_UDIMDiscardUV ("Discard UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _UDIMDiscardMode ("Discard Mode", Int) = 1
+ [Vector4Toggles]_UDIMDiscardRow3 ("y = 3", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow2 ("y = 2", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow1 ("y = 1", Vector) = (1,1,1,1)
+ [Vector4Toggles]_UDIMDiscardRow0 ("y = 0", Vector) = (1,1,1,1)
+ [HideInInspector] m_end_udimdiscardOptions ("UDIM Discard", Float) = 0
+
+ // Dissolve
+ [HideInInspector] m_start_dissolve ("Dissolve--{reference_property:_EnableDissolve}", Float) = 0
+ [HideInInspector][ThryToggle(DISTORT)]_EnableDissolve ("Enable Dissolve", Float) = 0
+ [Enum(Basic, 1, Point2Point, 2)] _DissolveType ("Dissolve Type", Int) = 1
+ _DissolveEdgeWidth ("Edge Width", Range(0, .5)) = 0.025
+ _DissolveEdgeHardness ("Edge Hardness", Range(0, 1)) = 0.5
+ _DissolveEdgeColor ("Edge Color--{reference_property:_DissolveEdgeColorThemeIndex}", 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)] _DissolveEdgeColorThemeIndex ("", Int) = 0
+ [Gradient]_DissolveEdgeGradient ("Edge Gradient", 2D) = "white" { }
+ _DissolveEdgeEmission ("Edge Emission", Range(0, 20)) = 0
+ _DissolveTextureColor ("Dissolved Color--{reference_property:_DissolveTextureColorThemeIndex}", 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)] _DissolveTextureColorThemeIndex ("", Int) = 0
+ _DissolveToTexture ("Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveToTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveToTextureUV ("UV", Int) = 0
+ _DissolveToEmissionStrength ("Dissolved Emission Strength", Range(0, 20)) = 0
+ _DissolveNoiseTexture ("Dissolve Gradient--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveNoiseTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveNoiseTextureUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertNoise ("Invert?", Float) = 0
+ _DissolveDetailNoise ("Dissolve Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DissolveDetailNoisePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveDetailNoiseUV ("UV", Int) = 0
+ [HideInInspector][ToggleUI]_DissolveInvertDetailNoise ("Invert?", Float) = 0
+ _DissolveDetailStrength ("Dissolve Detail Strength", Range(0, 1)) = 0.1
+ _DissolveAlpha ("Dissolve Alpha", Range(0, 1)) = 0
+ _DissolveMask ("Dissolve Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DissolveMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DissolveMaskUV ("UV", Int) = 0
+ [ToggleUI]_DissolveUseVertexColors ("VertexColor.g Mask", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveMaskInvert ("Invert?", Float) = 0
+ _ContinuousDissolve ("Continuous Dissolve Speed", Float) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)] _EnableDissolveAudioLink ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveAlphaBand ("Dissolve Alpha Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveAlpha ("Dissolve Alpha Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkDissolveDetailBand ("Dissolve Detail Band--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2]_AudioLinkDissolveDetail ("Dissolve Detail Mod--{ condition_showS:(_EnableDissolveAudioLink==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 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
+ _DissolveP2PEdgeLength ("Edge Length", Float) = 0.1
+ [Vector3]_DissolveStartPoint ("Start Point", Vector) = (0, -1, 0, 0)
+ [Vector3]_DissolveEndPoint ("End Point", Vector) = (0, 1, 0, 0)
+ [HideInInspector] m_end_pointToPoint ("Point To Point", Float) = 0
+
+ [HideInInspector] m_start_dissolveHueShift ("Hue Shift--{reference_property:_DissolveHueShiftEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_DissolveHueShiftEnabled ("Dissolved Enabled", Float) = 0
+ _DissolveHueShiftSpeed ("Dissolved Speed", Float) = 0
+ _DissolveHueShift ("Dissolved Shift", Range(0, 1)) = 0
+ [ToggleUI]_DissolveEdgeHueShiftEnabled ("Edge Enabled", Float) = 0
+ _DissolveEdgeHueShiftSpeed ("Edge Speed", Float) = 0
+ _DissolveEdgeHueShift ("Edge Shift", Range(0, 1)) = 0
+ [HideInInspector] m_end_dissolveHueShift ("Hue Shift", Float) = 0
+
+ // Locked in anim sldiers
+ [HideInInspector] m_start_BonusSliders ("Locked In Anim Sliders", Float) = 0
+ _DissolveAlpha0 ("Dissolve Alpha 0", Range(-1, 1)) = 0
+ _DissolveAlpha1 ("Dissolve Alpha 1", Range(-1, 1)) = 0
+ _DissolveAlpha2 ("Dissolve Alpha 2", Range(-1, 1)) = 0
+ _DissolveAlpha3 ("Dissolve Alpha 3", Range(-1, 1)) = 0
+ _DissolveAlpha4 ("Dissolve Alpha 4", Range(-1, 1)) = 0
+ _DissolveAlpha5 ("Dissolve Alpha 5", Range(-1, 1)) = 0
+ _DissolveAlpha6 ("Dissolve Alpha 6", Range(-1, 1)) = 0
+ _DissolveAlpha7 ("Dissolve Alpha 7", Range(-1, 1)) = 0
+ _DissolveAlpha8 ("Dissolve Alpha 8", Range(-1, 1)) = 0
+ _DissolveAlpha9 ("Dissolve Alpha 9", Range(-1, 1)) = 0
+ [HideInInspector] m_end_BonusSliders ("Locked In Sliders", Float) = 0
+ [HideInInspector] m_end_dissolve ("Dissolve", Float) = 0
+
+ // Flipbook
+ [HideInInspector] m_start_flipBook ("Flipbook--{reference_property:_EnableFlipbook}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_HIGH_QUALITY)]_EnableFlipbook ("Enable Flipbook", Float) = 0
+ [ToggleUI]_FlipbookAlphaControlsFinalAlpha ("Flipbook Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookIntensityControlsAlpha ("Intensity Controls Alpha?", Float) = 0
+ [ToggleUI]_FlipbookColorReplaces ("Color Replaces Flipbook", Float) = 0
+ [TextureArray]_FlipbookTexArray ("Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}", 2DArray) = "" { }
+ [HideInInspector][Vector2]_FlipbookTexArrayPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookTexArrayUV ("UV", Int) = 0
+ _FlipbookMask ("Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_FlipbookMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _FlipbookMaskUV ("UV", Int) = 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
+ _FlipbookTotalFrames ("Total Frames", Float) = 1
+ _FlipbookFPS ("FPS", Float) = 30.0
+ _FlipbookScaleOffset ("Scale | Offset", Vector) = (1, 1, 0, 0)
+ _FlipbookSideOffset ("Side Offset ←→↓↑", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookTiled ("Tiled?", Float) = 0
+ _FlipbookEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ _FlipbookRotation ("Rotation", Range(0, 360)) = 0
+ _FlipbookRotationSpeed ("Rotation Speed", Float) = 0
+ _FlipbookReplace ("Replace", Range(0, 1)) = 1
+ _FlipbookMultiply ("Multiply", Range(0, 1)) = 0
+ _FlipbookAdd ("Add", Range(0, 1)) = 0
+ // Flipbook Manual Control
+ [ThryToggleUI(true)]_FlipbookManualFrameControl ("<size=13><b> Manual Frame Control</b></size>", Float) = 0
+ _FlipbookCurrentFrame ("Current Frame--{ condition_showS:_FlipbookManualFrameControl==1}", Float) = 0
+ [ThryToggleUI(true)]_FlipbookCrossfadeEnabled ("<size=13><b> Crossfade</b></size>", Float) = 0
+ [MultiSlider]_FlipbookCrossfadeRange ("Fade Range--{ condition_showS:_FlipbookCrossfadeEnabled==1}", Vector) = (0.75, 1, 0, 1)
+ [ThryToggleUI(true)]_FlipbookHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _FlipbookHueShiftSpeed ("Shift Speed--{ condition_showS:_FlipbookHueShiftEnabled==1}", Float) = 0
+ _FlipbookHueShift ("Hue Shift--{ condition_showS:_FlipbookHueShiftEnabled==1}", Range(0, 1)) = 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)] _AudioLinkFlipbookScaleBand ("Scale Band", Int) = 0
+ _AudioLinkFlipbookScale ("Scale Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookAlphaBand ("Alpha Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookAlpha ("Alpha Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookEmissionBand ("Emission Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookEmission ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkFlipbookFrameBand ("Frame Band", Int) = 0
+ [Vector2]_AudioLinkFlipbookFrame ("Frame control", Vector) = (0, 0, 0, 0)
+ [ToggleUI]_FlipbookChronotensityEnabled ("Chronotensity?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _FlipbookChronotensityBand ("Chrono Band--{ condition_showS:_FlipbookChronotensityEnabled==1}", 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)]_FlipbookChronoType ("Chrono Type--{ condition_showS:_FlipbookChronotensityEnabled==1}", Int) = 0
+ _FlipbookChronotensitySpeed ("Chrono Speed--{ condition_showS:_FlipbookChronotensityEnabled==1}", Float) = 0
+ [HideInInspector] m_end_FlipbookAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_flipBook ("Flipbook", Float) = 0
+
+ //TODO Add inverts to the masks
+ //Emission 1
+ [HideInInspector] m_start_emissions ("Emissions", Float) = 0
+ [HideInInspector] m_start_emissionOptions ("Emission 0--{reference_property:_EnableEmission}", Float) = 0
+ [HideInInspector][ThryToggle(_EMISSION)]_EnableEmission ("Enable Emission", Float) = 0
+ [ToggleUI]_EmissionReplace0 ("Replace Base Color", Float) = 0
+ [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
+ [Gradient]_EmissionMap ("Emission Map--{reference_properties:[_EmissionMapPan, _EmissionMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMapUV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap ("Base Color as Map?", Float) = 0
+ _EmissionMask ("Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV, _EmissionMaskInvert]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMaskUV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert ("Invert", Float) = 0
+ _EmissionStrength ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled==1)}", Float) = 0
+
+ // Center out emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled==1)}", Float) = 5
+
+ // Glow in the dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh ("Lighting Type--{condition_showS:(_EnableGITDEmission==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMinLight ("Min Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight ("Max Lighting--{condition_showS:(_EnableGITDEmission==1)}", Range(0, 1)) = 1
+
+ // Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+ _EmissiveBlink_Max ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 1
+ _EmissiveBlink_Velocity ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 4
+ _EmissionBlinkingOffset ("Offset--{condition_showS:(_EmissionBlinkingEnabled==1)}", Float) = 0
+
+ // Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve ("Use Curve--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve ("Curve--{condition_showS:(_ScrollingEmission==1&&_EmissionScrollingUseCurve==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor ("VColor as position--{condition_showS:(_ScrollingEmission==1)}", float) = 0
+ _EmissiveScroll_Direction ("Direction--{condition_showS:(_ScrollingEmission==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width ("Width--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Velocity ("Velocity--{condition_showS:(_ScrollingEmission==1)}", Float) = 10
+ _EmissiveScroll_Interval ("Interval--{condition_showS:(_ScrollingEmission==1)}", Float) = 20
+ _EmissionScrollingOffset ("Offset--{condition_showS:(_ScrollingEmission==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL0Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL0StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL0StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission0CenterOut ("Center Out--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission0CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission0CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL0Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emissionOptions ("", Float) = 0
+
+ // Second Emission
+ [HideInInspector] m_start_emission1Options ("Emission 1--{reference_property:_EnableEmission1}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_1)]_EnableEmission1 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace1 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor1 ("Emission Color--{reference_property:_EmissionColor1ThemeIndex}", 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)] _EmissionColor1ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap1 ("Emission Map--{reference_properties:[_EmissionMap1Pan, _EmissionMap1UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap1 ("Base Color as Map?", Float) = 0
+ _EmissionMask1 ("Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV, _EmissionMaskInvert1]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask1UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert1 ("Invert", Float) = 0
+ _EmissionStrength1 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled1 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift1 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed1 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled1==1)}", Float) = 0
+
+ // Second Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled1 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed1 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled1==1)}", Float) = 5
+
+ // Second Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission1 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh1 ("Lighting Type--{condition_showS:(_EnableGITDEmission1==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier1 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier1 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMinLight1 ("Min Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight1 ("Max Lighting--{condition_showS:(_EnableGITDEmission1==1)}", Range(0, 1)) = 1
+
+ // Second Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled1 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min1 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+ _EmissiveBlink_Max1 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 1
+ _EmissiveBlink_Velocity1 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 4
+ _EmissionBlinkingOffset1 ("Offset--{condition_showS:(_EmissionBlinkingEnabled1==1)}", Float) = 0
+
+ // Second Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission1 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve1 ("Use Curve--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve1 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve1==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor1 ("VColor as position--{condition_showS:(_ScrollingEmission1==1)}", float) = 0
+ _EmissiveScroll_Direction1 ("Direction--{condition_showS:(_ScrollingEmission1==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width1 ("Width--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Velocity1 ("Velocity--{condition_showS:(_ScrollingEmission1==1)}", Float) = 10
+ _EmissiveScroll_Interval1 ("Interval--{condition_showS:(_ScrollingEmission1==1)}", Float) = 20
+ _EmissionScrollingOffset1 ("Offset--{condition_showS:(_ScrollingEmission1==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL1Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL1StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL1StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission1CenterOut ("Center Out--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission1CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission1CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL1Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission1Options ("", Float) = 0
+
+ // Third Emission
+ [HideInInspector] m_start_emission2Options ("Emission 2--{reference_property:_EnableEmission2}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_2)]_EnableEmission2 ("Enable Emission 2", Float) = 0
+ [ToggleUI]_EmissionReplace2 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor2 ("Emission Color--{reference_property:_EmissionColor2ThemeIndex}", 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)] _EmissionColor2ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap2 ("Emission Map--{reference_properties:[_EmissionMap2Pan, _EmissionMap2UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap2Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap2 ("Base Color as Map?", Float) = 0
+ _EmissionMask2 ("Emission Mask--{reference_properties:[_EmissionMask2Pan, _EmissionMask2UV, _EmissionMaskInvert2]}", 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 XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask2UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert2 ("Invert", Float) = 0
+ _EmissionStrength2 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled2 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift2 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed2 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled2==1)}", Float) = 0
+
+ // Third Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled2 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed2 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled2==1)}", Float) = 5
+
+ // Third Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission2 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh2 ("Lighting Type--{condition_showS:(_EnableGITDEmission2==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier2 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier2 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMinLight2 ("Min Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight2 ("Max Lighting--{condition_showS:(_EnableGITDEmission2==1)}", Range(0, 1)) = 1
+
+ // Third Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled2 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min2 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+ _EmissiveBlink_Max2 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 1
+ _EmissiveBlink_Velocity2 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 4
+ _EmissionBlinkingOffset2 ("Offset--{condition_showS:(_EmissionBlinkingEnabled2==1)}", Float) = 0
+
+ // Third Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission2 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve2 ("Use Curve--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve2 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve2==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor2 ("VColor as position--{condition_showS:(_ScrollingEmission2==1)}", float) = 0
+ _EmissiveScroll_Direction2 ("Direction--{condition_showS:(_ScrollingEmission2==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width2 ("Width--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Velocity2 ("Velocity--{condition_showS:(_ScrollingEmission2==1)}", Float) = 10
+ _EmissiveScroll_Interval2 ("Interval--{condition_showS:(_ScrollingEmission2==1)}", Float) = 20
+ _EmissionScrollingOffset2 ("Offset--{condition_showS:(_ScrollingEmission2==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL2Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL2StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL2StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission2CenterOut ("Center Out--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission2CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission2CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL2Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission2Options ("", Float) = 0
+
+ // Fourth Emission
+ [HideInInspector] m_start_emission3Options ("Emission 3--{reference_property:_EnableEmission3}", Float) = 0
+ [HideInInspector][ThryToggle(POI_EMISSION_3)]_EnableEmission3 ("Enable Emission 3", Float) = 0
+ [ToggleUI]_EmissionReplace3 ("Replace Base Color", Float) = 0
+ [HDR]_EmissionColor3 ("Emission Color--{reference_property:_EmissionColor3ThemeIndex}", 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)] _EmissionColor3ThemeIndex ("", Int) = 0
+ [Gradient]_EmissionMap3 ("Emission Map--{reference_properties:[_EmissionMap3Pan, _EmissionMap3UV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMap3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMap3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionBaseColorAsMap3 ("Base Color as Map?", Float) = 0
+ _EmissionMask3 ("Emission Mask--{reference_properties:[_EmissionMask3Pan, _EmissionMask3UV, _EmissionMaskInvert3]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_EmissionMask3Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _EmissionMask3UV ("UV", Int) = 0
+ [ToggleUI]_EmissionMaskInvert3 ("Invert", Float) = 0
+ _EmissionStrength3 ("Emission Strength", Range(0, 20)) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionHueShiftEnabled3 ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _EmissionHueShift3 ("Hue Shift--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Range(0, 1)) = 0
+ _EmissionHueShiftSpeed3 ("Hue Shift Speed--{condition_showS:(_EmissionHueShiftEnabled3==1)}", Float) = 0
+
+ // Fourth Center Out Enission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionCenterOutEnabled3 ("<size=13><b> Center Out</b></size>", Float) = 0
+ _EmissionCenterOutSpeed3 ("Flow Speed--{condition_showS:(_EmissionCenterOutEnabled3==1)}", Float) = 5
+
+ // Fourth Glow In The Dark Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EnableGITDEmission3 ("<size=13><b> Light Based</b></size>", Float) = 0
+ [Enum(World, 0, Mesh, 1)] _GITDEWorldOrMesh3 ("Lighting Type--{condition_showS:(_EnableGITDEmission3==1)}", Int) = 0
+ _GITDEMinEmissionMultiplier3 ("Min Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+ _GITDEMaxEmissionMultiplier3 ("Max Emission Multiplier--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMinLight3 ("Min Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 0
+ _GITDEMaxLight3 ("Max Lighting--{condition_showS:(_EnableGITDEmission3==1)}", Range(0, 1)) = 1
+
+ // Fourth Blinking Emission
+ [Space(4)]
+ [ThryToggleUI(true)]_EmissionBlinkingEnabled3 ("<size=13><b> Blinking</b></size>", Float) = 0
+ _EmissiveBlink_Min3 ("Emissive Blink Min--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+ _EmissiveBlink_Max3 ("Emissive Blink Max--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 1
+ _EmissiveBlink_Velocity3 ("Emissive Blink Velocity--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 4
+ _EmissionBlinkingOffset3 ("Offset--{condition_showS:(_EmissionBlinkingEnabled3==1)}", Float) = 0
+
+ // Fourth Scrolling Emission
+ [Space(4)]
+ [ThryToggleUI(true)] _ScrollingEmission3 ("<size=13><b> Scrolling</b></size>", Float) = 0
+ [ToggleUI]_EmissionScrollingUseCurve3 ("Use Curve--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ [Curve]_EmissionScrollingCurve3 ("Curve--{condition_showS:(_ScrollingEmission1==1&&_EmissionScrollingUseCurve3==1)}", 2D) = "white" { }
+ [ToggleUI]_EmissionScrollingVertexColor3 ("VColor as position--{condition_showS:(_ScrollingEmission3==1)}", float) = 0
+ _EmissiveScroll_Direction3 ("Direction--{condition_showS:(_ScrollingEmission3==1)}", Vector) = (0, -10, 0, 0)
+ _EmissiveScroll_Width3 ("Width--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Velocity3 ("Velocity--{condition_showS:(_ScrollingEmission3==1)}", Float) = 10
+ _EmissiveScroll_Interval3 ("Interval--{condition_showS:(_ScrollingEmission3==1)}", Float) = 20
+ _EmissionScrollingOffset3 ("Offset--{condition_showS:(_ScrollingEmission3==1)}", Float) = 0
+
+ [Space(4)]
+ [ThryToggleUI(true)] _EmissionAL3Enabled ("<size=13><b> Audio Link</b></size>--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Vector2]_EmissionAL3StrengthMod ("Emission Strength Add--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _EmissionAL3StrengthBand ("Emission Add Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [Vector2] _AudioLinkEmission3CenterOut ("Center Out--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Vector) = (0, 0, 0, 0)
+ _AudioLinkEmission3CenterOutSize ("Intensity Threshold--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Range(0, 1)) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkEmission3CenterOutBand ("Center Out Band--{ condition_showS:(_EmissionAL3Enabled==1 && _EnableAudioLink==1)}", Int) = 0
+ [HideInInspector] m_end_emission3Options ("", Float) = 0
+ [HideInInspector] m_end_emissions ("Emissions", Float) = 0
+
+ // Glitter
+ [HideInInspector] m_start_glitter ("Glitter / Sparkle--{reference_property:_GlitterEnable}", Float) = 0
+ [HideInInspector][ThryToggle(_SUNDISK_SIMPLE)]_GlitterEnable ("Enable Glitter?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterUV ("UV", Int) = 0
+ [Enum(Angle, 0, Linear Emission, 1, Light Reflections, 2)]_GlitterMode ("Mode", Int) = 0
+ [Enum(Circle, 0, Square, 1)]_GlitterShape ("Shape", Int) = 0
+ [Enum(Add, 0, Replace, 1)] _GlitterBlendType ("Blend Mode", Int) = 0
+ [HDR]_GlitterColor ("Color--{reference_property:_GlitterColorThemeIndex}", 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)] _GlitterColorThemeIndex ("", Int) = 0
+ _GlitterUseSurfaceColor ("Use Surface Color", Range(0, 1)) = 0
+ _GlitterColorMap ("Glitter Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterColorMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterColorMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_GlitterPan ("Panning", Vector) = (0, 0, 0, 0)
+ _GlitterMask ("Glitter Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _GlitterMaskUV ("UV", Int) = 0
+ _GlitterTexture ("Glitter Texture--{reference_properties:[_GlitterTexturePan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_GlitterTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [Vector2]_GlitterUVPanning ("Panning Speed", Vector) = (0, 0, 0, 0)
+ _GlitterTextureRotation ("Rotation Speed", Float) = 0
+ _GlitterFrequency ("Glitter Density", Float) = 300.0
+ _GlitterJitter ("Glitter Jitter", Range(0, 1)) = 1.0
+ _GlitterSpeed ("Glitter Speed", Float) = 10.0
+ _GlitterSize ("Glitter Size", Range(0, 1)) = .3
+ _GlitterContrast ("Glitter Contrast--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(1, 1000)) = 300
+ _GlitterAngleRange ("Glitter Angle Range--{condition_showS:(_GlitterMode==0||_GlitterMode==2)}", Range(0, 90)) = 90
+ _GlitterMinBrightness ("Glitter Min Brightness", Range(0, 1)) = 0
+ _GlitterBrightness ("Glitter Max Brightness", Range(0, 40)) = 3
+ _GlitterBias ("Glitter Bias--{condition_show:(_GlitterMode==0)}", Range(0, 1)) = .8
+ _GlitterHideInShadow ("Hide in shadow", Range(0, 1)) = 0
+ _GlitterCenterSize ("dim light--{condition_show:{type:AND,condition1:{type:PROPERTY_BOOL,data:_GlitterMode==1},condition2:{type:PROPERTY_BOOL,data:_GlitterShape==1}}}", Range(0, 1)) = .08
+ _glitterFrequencyLinearEmissive ("Frequency--{condition_show:{type:PROPERTY_BOOL,data:_GlitterMode==1}}", Range(0, 100)) = 20
+ _GlitterJaggyFix ("Jaggy Fix--{condition_show:{type:PROPERTY_BOOL,data:_GlitterShape==1}}", Range(0, .1)) = .0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _GlitterHueShiftSpeed ("Shift Speed--{condition_showS:(_GlitterHueShiftEnabled==1)}", Float) = 0
+ _GlitterHueShift ("Hue Shift--{condition_showS:(_GlitterHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_GlitterRandomColors ("<size=13><b> Random Stuff</b></size>", Float) = 0
+ [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)
+ [ToggleUI]_GlitterRandomSize ("Random Size?--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+ [MultiSlider]_GlitterMinMaxSize ("Size Range--{condition_showS:(_GlitterRandomColors==1)}", Vector) = (0.1, 0.5, 0, 1)
+ [ToggleUI]_GlitterRandomRotation ("Random Tex Rotation--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_end_glitter ("Glitter / Sparkle--{condition_showS:(_GlitterRandomColors==1)}", Float) = 0
+
+ [HideInInspector] m_start_pathing ("Pathing--{reference_property: _EnablePathing}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PATHING)] _EnablePathing ("Enable Pathing", Float) = 0
+ [Enum(Split Channels, 0, Merged Channels, 1)]_PathGradientType ("Gradient Type", Float) = 0
+ [ToggleUI]_PathingOverrideAlpha ("Override alpha", Float) = 0
+ //[ThryExternalTextureToolDrawer(Flood Tool, DreadScripts.GradientFlood)]
+ [ThryRGBAPacker(R Path, G Path, B Path, A Path)]_PathingMap ("RGBA Path Map--{reference_properties:[_PathingMapPan, _PathingMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PathingMapUV ("UV", Int) = 0
+ [HideInInspector][Vector2]_PathingMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_PathingColorMap ("Color & Mask (Expand)--{reference_properties:[_PathingColorMapPan, _PathingColorMapUV]}", 2D) = "white" { }
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, 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)
+ [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)] _PathColorGThemeIndex ("", Int) = 0
+ [HDR]_PathColorB ("B Color--{reference_property:_PathColorBThemeIndex}", 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)] _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
+
+ _PathEmissionStrength ("Emission Strength", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _PathSoftness ("Softness", Vector) = (1, 1, 1, 1)
+ _PathSpeed ("Speed", Vector) = (1.0, 1.0, 1.0, 1.0)
+ _PathWidth ("Length", Vector) = (0.03, 0.03, 0.03, 0.03)
+
+ [Header(Timing Options)]
+ _PathTime ("Manual Timing", Vector) = (-999.0, -999.0, -999.0, -999.0)
+ _PathOffset ("Timing Offset", Vector) = (0.0, 0.0, 0.0, 0.0)
+ _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 ("<size=13><b> Time Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandR ("Band R--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetR ("Offset R--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandG ("Band G--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetG ("Offset G--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandB ("Band B--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetB ("Offset B--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathTimeOffsetBandA ("Band A--{condition_showS:(_PathALTimeOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathTimeOffsetA ("Offset A--{condition_showS:(_PathALTimeOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALEmissionOffset ("<size=13><b> Emission Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandR ("Band R--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddR ("Offset R--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandG ("Band G--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddG ("Offset G--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandB ("Band B--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddB ("Offset B--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathEmissionAddBandA ("Band A--{condition_showS:(_PathALEmissionOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathEmissionAddA ("Offset A--{condition_showS:(_PathALEmissionOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALWidthOffset ("<size=13><b> Width Offset</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandR ("Band R--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetR ("Offset R--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandG ("Band G--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetG ("Offset G--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandB ("Band B--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetB ("Offset B--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _AudioLinkPathWidthOffsetBandA ("Band A--{condition_showS:(_PathALWidthOffset==1)}", Int) = 0
+ [Vector2]_AudioLinkPathWidthOffsetA ("Offset A--{condition_showS:(_PathALWidthOffset==1)}", Vector) = (0, 0, 0)
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALHistory ("<size=13><b> History</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandR ("R Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryR ("R History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandG ("G Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryG ("G History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandB ("B Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryB ("B History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathALHistoryBandA ("A Band--{condition_showS:(_PathALHistory==1)}", Int) = 0
+ [ToggleUI]_PathALHistoryA ("A History--{condition_showS:(_PathALHistory==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALChrono ("<size=13><b> Chrono Time</b></size>", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandR ("R Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeR ("R Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedR ("R Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandG ("G Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeG ("G Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedG ("G Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandB ("B Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeB ("B Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedB ("B Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _PathChronoBandA ("A Band--{condition_showS:(_PathALChrono==1)}", 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)]_PathChronoTypeA ("A Motion Type--{condition_showS:(_PathALChrono==1)}", Int) = 0
+ _PathChronoSpeedA ("A Speed--{condition_showS:(_PathALChrono==1)}", Float) = 0
+ [Space(4)]
+ [ThryToggleUI(true)]_PathALAutoCorrelator ("<size=13><b> Auto Correlator</b></size>", Float) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorR ("R Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorG ("G Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorB ("B Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Enum(Off, 0, On, 1, Mirrored, 2)]_PathALAutoCorrelatorA ("A Type--{condition_showS:(_PathALAutoCorrelator==1)}", Int) = 0
+ [Space(4)]
+ [ToggleUI]_PathALCCR ("R Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCG ("G Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCB ("B Color Chord Strip", Float) = 0
+ [ToggleUI]_PathALCCA ("A Color Chord Strip", Float) = 0
+ [HideInInspector] m_end_PathAudioLink ("", Float) = 0
+ [HideInInspector] m_end_pathing ("", Float) = 0
+
+ // Mirror Rendering
+ [HideInInspector] m_start_mirrorOptions ("Mirror--{reference_property:_EnableMirrorOptions}", Float) = 0
+ [HideInInspector][ThryToggle(POI_MIRROR)]_EnableMirrorOptions ("Enable Mirror Options", Float) = 0
+ [ThryWideEnum(Show In Both, 0, Show Only In Mirror, 1, Dont Show In Mirror, 2)] _Mirror ("Show in mirror", Int) = 0
+ _MirrorTexture ("Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]},", 2D) = "white" { }
+ [HideInInspector][Vector2]_MirrorTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _MirrorTextureUV("UV", Int) = 0
+ [HideInInspector] m_end_mirrorOptions ("Mirror", Float) = 0
+
+ [HideInInspector] m_start_depthFX ("Depth FX--{reference_property:_EnableTouchGlow}", Float) = 0
+ [HideInInspector][ThryToggle(GRAIN)]_EnableTouchGlow ("Enable Depth FX", Float) = 0
+ _DepthMask ("Mask--{reference_properties:[_DepthMaskPan, _DepthMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _DepthMaskUV ("UV", Int) = 0
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthColorToggle ("<size=13><b> Color & Emission</b></size>", Float) = 0
+ [ThryWideEnum(Replace, 0, Multiply, 1, Add, 2)] _DepthColorBlendMode ("Blend Type--{condition_showS:(_DepthColorToggle==1)}", Int) = 0
+ _DepthTexture ("Depth Texture--{reference_properties:[_DepthTexturePan, _DepthTextureUV], condition_showS:(_DepthColorToggle==1)}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DepthTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7, Depth Gradient, 8)] _DepthTextureUV ("UV", Int) = 0
+ _DepthColor ("Color--{condition_showS:(_DepthColorToggle==1), reference_property:_DepthColorThemeIndex}", 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)] _DepthColorThemeIndex ("", Int) = 0
+ _DepthEmissionStrength ("Emission Strength--{condition_showS:(_DepthColorToggle==1)}", Range(0, 20)) = 0
+ _DepthColorMinDepth ("Min Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 0
+ _DepthColorMaxDepth ("Max Depth--{condition_showS:(_DepthColorToggle==1)}", Float) = 1
+ _DepthColorMinValue ("Min Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 0
+ _DepthColorMaxValue ("Max Color Blend--{condition_showS:(_DepthColorToggle==1)}", Range(0, 1)) = 1
+
+ [Space(10)]
+ [ThryToggleUI(true)]_DepthAlphaToggle ("<size=13><b> Alpha</b></size>", Float) = 0
+ _DepthAlphaMinDepth ("Min Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 0
+ _DepthAlphaMaxDepth ("Max Depth--{condition_showS:(_DepthAlphaToggle==1)}", Float) = 1
+ _DepthAlphaMinValue ("Min Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 1
+ _DepthAlphaMaxValue ("Max Alpha--{condition_showS:(_DepthAlphaToggle==1)}", Range(0, 1)) = 0
+ [HideInInspector] m_end_depthFX ("Depth FX", Float) = 0
+
+ [HideInInspector] m_start_Iridescence ("Iridescence--{reference_property:_EnableIridescence}", Float) = 0
+ [HideInInspector][ThryToggle(POI_IRIDESCENCE)]_EnableIridescence ("Enable Iridescence", Float) = 0
+ [Gradient]_IridescenceRamp ("Ramp--{reference_properties:[_IridescenceRampPan]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceRampPan ("Panning", Vector) = (0, 0, 0, 0)
+
+ _IridescenceMask ("Mask--{reference_properties:[_IridescenceMaskPan, _IridescenceMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_IridescenceMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceMaskUV ("Mask UV", Int) = 0
+
+ [ToggleUI]_IridescenceNormalToggle ("Custom Normals?", Float) = 0
+ [Normal]_IridescenceNormalMap ("Normal Map--{reference_properties:[_IridescenceNormalIntensity, _IridescenceNormalMapPan, _IridescenceNormalMapUV]}", 2D) = "bump" { }
+ [HideInInspector]_IridescenceNormalIntensity ("Normal Intensity", Range(0, 10)) = 1
+ [HideInInspector][Vector2]_IridescenceNormalMapPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_IridescenceNormalMapUV ("Normal UV", Int) = 0
+ [Enum(Vertex, 0, Pixel, 1)] _IridescenceNormalSelection ("Normal Select", Int) = 1
+ _IridescenceIntensity ("Intensity", Range(0, 10)) = 1
+ _IridescenceAddBlend ("Blend Add", Range(0, 1)) = 0
+ _IridescenceReplaceBlend ("Blend Replace", Range(0, 1)) = 0
+ _IridescenceMultiplyBlend ("Blend Multiply", Range(0, 1)) = 0
+ _IridescenceEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [ThryToggleUI(true)]_IridescenceHueShiftEnabled ("<size=13><b> Hue Shift</b></size>", Float) = 0
+ _IridescenceHueShiftSpeed ("Speed--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Float) = 0
+ _IridescenceHueShift ("Shift--{condition_showS:(_IridescenceHueShiftEnabled==1)}", Range(0, 1)) = 0
+
+ // Iridescence Audio Link
+ [HideInInspector] m_start_IridescenceAudioLink ("Audio Link ♫--{ condition_showS:_EnableAudioLink==1}", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _IridescenceAudioLinkEmissionAddBand ("Emission Band", Int) = 0
+ [Vector2]_IridescenceAudioLinkEmissionAdd ("Emission Mod", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_IridescenceAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_Iridescence ("Iridescence", Float) = 0
+
+ // MSDF OVERLAY
+ [HideInInspector] m_start_Text ("Stats Overlay--{reference_property:_TextEnabled}", Float) = 0
+ _TextGlyphs ("Font Array", 2D) = "black" { }
+ _TextPixelRange ("Pixel Range", Float) = 4.0
+ [HideInInspector][ThryToggle(EFFECT_BUMP)]_TextEnabled ("Text?", Float) = 0
+
+ // FPS
+ [HideInInspector] m_start_TextFPS ("FPS--{reference_property:_TextFPSEnabled}", Float) = 0
+ [HideInInspector][ToggleUI]_TextFPSEnabled ("FPS Text?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextFPSUV ("FPS UV", Int) = 0
+ _TextFPSColor ("Color--{reference_property:_TextFPSColorThemeIndex}", 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)] _TextFPSColorThemeIndex ("", Int) = 0
+ _TextFPSEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextFPSOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextFPSRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextFPSScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextPositionUV ("Position UV", Int) = 0
+ //[ToggleUI]_TextPositionVertical ("Vertical?", Float) = 0
+ _TextPositionColor ("Color--{reference_property:_TextPositionColorThemeIndex}", Color) = (1, 0, 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)] _TextPositionColorThemeIndex ("", Int) = 0
+ _TextPositionEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextPositionOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextPositionRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextPositionScale ("Scale", Vector) = (1, 1, 1, 1)
+ _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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _TextTimeUV ("Time UV", Int) = 0
+ _TextTimeColor ("Color--{reference_property:_TextTimeColorThemeIndex}", Color) = (1, 0, 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)] _TextTimeColorThemeIndex ("", Int) = 0
+ _TextTimeEmissionStrength ("Emission Strength", Range(0, 20)) = 0
+ [Vector2]_TextTimeOffset ("Offset", Vector) = (0, 0, 0, 0)
+ _TextTimeRotation ("Rotation", Range(0, 360)) = 0
+ [Vector2]_TextTimeScale ("Scale", Vector) = (1, 1, 1, 1)
+ _TextTimePadding ("Padding Reduction", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_TextInstanceTime ("Instance Time", Float) = 0
+ [HideInInspector] m_end_Text ("MSDF Text Overlay", Float) = 0
+
+ [HideInInspector] m_start_FXProximityColor ("Proximity Color--{reference_property:_FXProximityColor}", Float) = 0
+ [HideInInspector][ToggleUI]_FXProximityColor ("Enable", Float) = 0
+ [Enum(Object Position, 0, Pixel Position, 1)]_FXProximityColorType ("Pos To Use", Int) = 1
+ _FXProximityColorMinColor ("Min Distance Alpha", Color) = (0, 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)] _FXProximityColorMinColorThemeIndex ("", Int) = 0
+ _FXProximityColorMaxColor ("Max Distance Alpha", 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)] _FXProximityColorMaxColorThemeIndex ("", Int) = 0
+ _FXProximityColorMinDistance ("Min Distance", Float) = 0
+ _FXProximityColorMaxDistance ("Max Distance", Float) = 1
+ [HideInInspector] m_end_FXProximityColor ("", Float) = 0
+
+ // Poi Extras
+ // Audio link
+ [HideInInspector] m_AudioLinkCategory (" Audio Link--{reference_property:_EnableAudioLink}", 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
+ [ToggleUI] _AudioLinkAnimToggle ("Anim Toggle", Float) = 1
+ /*
+ _AudioLinkDelay ("Delay", Range(0, 1)) = 0
+ [ToggleUI]_AudioLinkCCStripY("CC Strip Y UV", Float) = 0
+ */
+ //[ToggleUI]_AudioLinkAveraging ("Enable averaging", Float) = 0
+ //_AudioLinkAverageRange ("Average Sampling Range", Range(0, 1)) = .5
+ [ThryHeaderLabel(Debug Visualizer, 13)]
+ [ToggleUI]_DebugWaveform("Waveform", Float) = 0
+ [ToggleUI]_DebugDFT("DFT", Float) = 0
+ [ToggleUI]_DebugBass("Bass", Float) = 0
+ [ToggleUI]_DebugLowMids("Low Mids", Float) = 0
+ [ToggleUI]_DebugHighMids("High Mids", Float) = 0
+ [ToggleUI]_DebugTreble("Treble", Float) = 0
+ [ToggleUI]_DebugCCColors("Colorchord Colors", Float) = 0
+ [ToggleUI]_DebugCCStrip("Colorchord Strip", Float) = 0
+ [ToggleUI]_DebugCCLights("Colorchord Lights", Float) = 0
+ [ToggleUI]_DebugAutocorrelator("Autocorrelator", Float) = 0
+ [ToggleUI]_DebugChronotensity("Chronotensity", Float) = 0
+ [Helpbox(1)]_DebugVisualizerHelpbox ("Debug examples are best viewed on a flat surface with simple uvs like a default unity quad.", Int) = 0
+
+ [HideInInspector] m_end_audioLink ("Audio Link", Float) = 0
+
+ [HideInInspector] m_start_ALDecalSpectrum ("AL ♫ Spectrum--{ reference_property:_EnableALDecal}", 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
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalUV ("UV", Int) = 0
+ [Vector2]_ALUVPosition ("Position", Vector) = (.5, .5, 1)
+ _ALUVScale ("Scale", Vector) = (1, 1, 1, 1)
+ _ALUVRotation ("Rotation", Range(0, 360)) = 0
+ _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 ("<size=13><b> Shape Clip</b></size>", 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)]
+ [ThryRGBAPacker(1, RGB Color, A Mask, 1)]_ALDecalColorMask ("Color & Mask--{reference_properties:[_ALDecalColorMaskPan, _ALDecalColorMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_ALDecalColorMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)] _ALDecalColorMaskUV ("UV", Int) = 0
+ [Enum(UVX, 0, UVY, 1, Volume, 2)] _ALDecalVolumeColorSource ("Source", Int) = 1
+ _ALDecalVolumeColorLow ("Volume Color Low", Color) = (0, 0, 1)
+ _ALDecalLowEmission ("Low Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorMid ("Volume Color Mid", Color) = (0, 1, 0)
+ _ALDecalMidEmission ("Mid Emission", Range(0, 20)) = 0
+ _ALDecalVolumeColorHigh ("Volume Color High", Color) = (1, 0, 0)
+ _ALDecalHighEmission ("High Emission", Range(0, 20)) = 0
+ [ThryWideEnum(Replace, 0, Darken, 1, Multiply, 2, Color Burn, 3, Linear Burn, 4, Lighten, 5, Screen, 6, Color Dodge, 7, Linear Dodge(Add), 8, Overlay, 9, Soft Lighten, 10, Hard Light, 11, Vivid Light, 12, Linear Light, 13, Pin Light, 14, Hard Mix, 15, Difference, 16, Exclusion, 17, Subtract, 18, Divide, 19)]_ALDecalBlendType ("Blend Type", Range(0, 1)) = 0
+ _ALDecalBlendAlpha ("Alpha", Range(0, 1)) = 1
+ _ALDecalControlsAlpha ("Override Alpha", Range(0, 1)) = 0
+
+ [HideInInspector] m_end_ALDecalSpectrum ("AL ♫ Spectrum", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_modifierCategory ("UV Modifiers", Float) = 0
+ [HideInInspector] m_start_uvDistortion (" Distortion UV--{reference_property:_EnableDistortion}", Float) = 0
+ [HideInInspector][ThryToggle(USER_LUT)] _EnableDistortion ("Enabled?", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionUvToDistort ("Distorted UV", Int) = 0
+ _DistortionMask ("Mask--{reference_properties:[_DistortionMaskPan, _DistortionMaskUV]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_DistortionMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionMaskUV ("UV", Int) = 0
+ _DistortionFlowTexture ("Distortion Texture 1--{reference_properties:[_DistortionFlowTexturePan, _DistortionFlowTextureUV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexturePan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTextureUV ("UV", Int) = 0
+ _DistortionFlowTexture1 ("Distortion Texture 2--{reference_properties:[_DistortionFlowTexture1Pan, _DistortionFlowTexture1UV]}", 2D) = "black" { }
+ [HideInInspector][Vector2]_DistortionFlowTexture1Pan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6)] _DistortionFlowTexture1UV ("UV", Int) = 0
+ _DistortionStrength ("Strength1", Float) = 0.03
+ _DistortionStrength1 ("Strength2", Float) = 0.01
+ [HideInInspector] m_start_DistortionAudioLink ("Audio Link ♫--{reference_property:_EnableDistortionAudioLink, condition_showS:_EnableAudioLink==1}", Float) = 0
+ [HideInInspector][ToggleUI] _EnableDistortionAudioLink ("Enabled?", Float) = 0
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrengthAudioLinkBand ("Strength 1 Band", Int) = 0
+ [Vector2]_DistortionStrengthAudioLink ("Strength 1 Offset Range", Vector) = (0, 0, 0, 0)
+ [Enum(Bass, 0, Low Mid, 1, High Mid, 2, Treble, 3)] _DistortionStrength1AudioLinkBand ("Strength 2 Band", Int) = 0
+ [Vector2]_DistortionStrength1AudioLink ("Strength 2 Offset Range", Vector) = (0, 0, 0, 0)
+ [HideInInspector] m_end_DistortionAudioLink ("Audio Link", Float) = 0
+ [HideInInspector] m_end_uvDistortion ("Distortion 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 XZ, 5)] _PolarUV ("UV", Int) = 0
+ [Vector2]_PolarCenter ("Center Coordinate", Vector) = (.5, .5, 0, 0)
+ _PolarRadialScale ("Radial Scale", Float) = 1
+ _PolarLengthScale ("Length Scale", Float) = 1
+ _PolarSpiralPower ("Spiral Power", Float) = 0
+ [HideInInspector] m_end_uvPolar ("Polar UV", Float) = 0
+
+ [HideInInspector] m_start_parallax (" Parallax Heightmapping--{reference_property:_PoiParallax}", Float) = 0
+ [HideInInspector][ThryToggle(POI_PARALLAX)]_PoiParallax ("Enable", Float) = 0
+ [ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_ParallaxUV ("Applies To: ", Int) = 0
+
+ [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 XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightMapUV ("UV", Int) = 0
+
+ [ThryTexture]_Heightmask ("Mask--{reference_properties:[_HeightmaskPan, _HeightmaskUV, _HeightmaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_HeightmaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_HeightmaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_HeightmaskUV ("UV", Int) = 0
+
+ _HeightStrength ("Strength", Range(0, 1)) = 0.4247461
+ //_HeightOffset ("Offset", Range(-1, 1)) = 0
+ _CurvatureU ("Curvature U", Range(0, 100)) = 0
+ _CurvatureV ("Curvature V", Range(0, 30)) = 0
+ [IntRange]_HeightStepsMin ("Steps Min", Range(0, 128)) = 10
+ [IntRange]_HeightStepsMax ("Steps Max", Range(0, 128)) = 128
+ _CurvFix ("Curvature Bias", Range(0, 1)) = 1
+ // [ThryToggle]_ParallaxUV0 ("UV0", Float) = 0
+ // [ThryToggle]_ParallaxUV1 ("UV1", Float) = 0
+ // [ThryToggle]_ParallaxUV2 ("UV2", Float) = 0
+ // [ThryToggle]_ParallaxUV3 ("UV3", Float) = 0
+ // [ThryToggle]_ParallaxPano ("Panosphere", Float) = 0
+ // [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
+
+ //Third party
+ [HideInInspector] m_thirdpartyCategory ("Third Party", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_postprocessing ("Post Processing", Float) = 0
+ [HideInInspector] m_start_PoiLightData ("PP Animations ", Float) = 0
+ [Helpbox(1)] _PPHelp ("This section meant for real time adjustments through animations and not to be changed in unity", Int) = 0
+ _PPLightingMultiplier ("Lighting Mulitplier", Float) = 1
+ _PPLightingAddition ("Lighting Add", Float) = 0
+ _PPEmissionMultiplier ("Emission Multiplier", Float) = 1
+ _PPFinalColorMultiplier ("Final Color Multiplier", Float) = 1
+ [HideInInspector] m_end_PoiLightData ("PP Animations ", Float) = 0
+
+ [HideInInspector] m_start_postprocess ("Post Processing--{reference_property:_PostProcess}", Float) = 0
+ [HideInInspector][ThryToggle(POSTPROCESS)]_PostProcess ("Enable", Float) = 0
+ [ThryTexture] _PPMask("Mask--{reference_properties:[_PPMaskPan, _PPMaskUV, _PPMaskInvert]}", 2D) = "white" { }
+ [HideInInspector][Vector2]_PPMaskPan ("Panning", Vector) = (0, 0, 0, 0)
+ [HideInInspector][ToggleUI]_PPMaskInvert ("Invert", Float) = 0
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7)]_PPMaskUV ("UV", Int) = 0
+
+ [NoScaleOffset][ThryTexture] _PPLUT("LUT", 2D) = "white" {}
+ _PPLUTStrength("LUT Strength", Range(0,1)) = 0
+ _PPHue("Hue", Range(0,1)) = 0
+ [HDR]_PPTint("Tint", Color) = (1,1,1,1)
+ [Vector3]_PPRGB("RGB", Vector) = (1,1,1,1)
+ _PPContrast("Contrast", Float) = 1
+ _PPSaturation("Saturation", Float) = 1
+ _PPBrightness("Brightness", Float) = 1
+ _PPLightness("Lightness", Float) = 0
+ _PPHDR("HDR", Float) = 0
+
+ [HideInInspector] m_end_postprocess ("", Float) = 0
+
+ // Rendering Options
+ [HideInInspector] m_renderingCategory ("Rendering", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ [Enum(Thry.ColorMask)] _ColorMask ("Color Mask", Int) = 15
+ _OffsetFactor ("Offset Factor", Float) = 0.0
+ _OffsetUnits ("Offset Units", Float) = 0.0
+ [ToggleUI]_RenderingReduceClipDistance ("Reduce Clip Distance", Float) = 0
+ [ToggleUI]_IgnoreFog ("Ignore Fog", Float) = 0
+ [HideInInspector] Instancing ("Instancing", Float) = 0 //add this property for instancing variants settings to be shown
+
+ // Blending Options
+ [HideInInspector] m_start_blending ("Blending", Float) = 0
+ [Enum(Thry.BlendOp)]_BlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_BlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend ("Destination Blend", Int) = 0
+ [Space][ThryHeaderLabel(Additive Blending, 13)]
+ [Enum(Thry.BlendOp)]_AddBlendOp ("RGB Blend Op", Int) = 0
+ [Enum(Thry.BlendOp)]_AddBlendOpAlpha ("Alpha Blend Op", Int) = 0
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddSrcBlend ("Source Blend", Int) = 1
+ [Enum(UnityEngine.Rendering.BlendMode)] _AddDstBlend ("Destination Blend", Int) = 1
+
+ [HideInInspector] m_end_blending ("Blending", Float) = 0
+
+ // Stencils
+ [HideInInspector] m_start_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ [IntRange] _StencilReadMask ("Stencil ReadMask Value", Range(0, 255)) = 255
+ [IntRange] _StencilWriteMask ("Stencil WriteMask Value", Range(0, 255)) = 255
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ [HideInInspector] m_end_StencilPassOptions ("Stencil", Float) = 0
+
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "VRCFallback" = "Standard" }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardBase" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_instancing
+ #pragma multi_compile_fog
+ #pragma multi_compile _ VERTEXLIGHT_ON
+ #define POI_PASS_BASE
+
+ // UNITY Includes
+ #include "UnityCG.cginc"
+ #include "UnityStandardUtils.cginc"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _EMISSION
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap;
+ #endif
+ float4 _EmissionMap_ST;
+ float2 _EmissionMapPan;
+ float _EmissionMapUV;
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask;
+ #endif
+ float4 _EmissionMask_ST;
+ float2 _EmissionMaskPan;
+ float _EmissionMaskUV;
+ float _EmissionMaskInvert;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve;
+ #endif
+ float4 _EmissionScrollingCurve_ST;
+
+ float4 _EmissionColor;
+ float _EmissionBaseColorAsMap;
+ float _EmissionStrength;
+ float _EmissionHueShiftEnabled;
+ float _EmissionHueShift;
+ float _EmissionHueShiftSpeed;
+ float _EmissionCenterOutEnabled;
+ float _EmissionCenterOutSpeed;
+ float _EnableGITDEmission;
+ float _GITDEWorldOrMesh;
+ float _GITDEMinEmissionMultiplier;
+ float _GITDEMaxEmissionMultiplier;
+ float _GITDEMinLight;
+ float _GITDEMaxLight;
+ float _EmissionBlinkingEnabled;
+ float _EmissiveBlink_Min;
+ float _EmissiveBlink_Max;
+ float _EmissiveBlink_Velocity;
+ float _EmissionBlinkingOffset;
+ float _ScrollingEmission;
+ float4 _EmissiveScroll_Direction;
+ float _EmissiveScroll_Width;
+ float _EmissiveScroll_Velocity;
+ float _EmissiveScroll_Interval;
+ float _EmissionScrollingOffset;
+
+ float _EmissionReplace0;
+ float _EmissionScrollingVertexColor;
+ float _EmissionScrollingUseCurve;
+ float _EmissionColorThemeIndex;
+
+ // Audio Link
+ float _EmissionAL0Enabled;
+ float2 _EmissionAL0StrengthMod;
+ float _EmissionAL0StrengthBand;
+ float2 _AudioLinkEmission0CenterOut;
+ float _AudioLinkEmission0CenterOutSize;
+ float _AudioLinkEmission0CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_1
+
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap1;
+ #endif
+ float4 _EmissionMap1_ST;
+ float2 _EmissionMap1Pan;
+ float _EmissionMap1UV;
+ #if defined(PROP_EMISSIONMASK1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask1;
+ #endif
+ float4 _EmissionMask1_ST;
+ float2 _EmissionMask1Pan;
+ float _EmissionMask1UV;
+ float _EmissionMaskInvert1;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve1;
+ #endif
+ float4 _EmissionScrollingCurve1_ST;
+
+ float4 _EmissionColor1;
+ float _EmissionBaseColorAsMap1;
+ float _EmissionStrength1;
+ float _EnableEmission1;
+ float _EmissionHueShift1;
+ float _EmissionHueShiftSpeed1;
+ float4 _EmissiveScroll_Direction1;
+ float _EmissiveScroll_Width1;
+ float _EmissiveScroll_Velocity1;
+ float _EmissiveScroll_Interval1;
+ float _EmissionBlinkingEnabled1;
+ float _EmissiveBlink_Min1;
+ float _EmissiveBlink_Max1;
+ float _EmissiveBlink_Velocity1;
+ float _ScrollingEmission1;
+ float _EnableGITDEmission1;
+ float _GITDEMinEmissionMultiplier1;
+ float _GITDEMaxEmissionMultiplier1;
+ float _GITDEMinLight1;
+ float _GITDEMaxLight1;
+ float _GITDEWorldOrMesh1;
+ float _EmissionCenterOutEnabled1;
+ float _EmissionCenterOutSpeed1;
+ float _EmissionHueShiftEnabled1;
+ float _EmissionBlinkingOffset1;
+ float _EmissionScrollingOffset1;
+ float _EmissionScrollingVertexColor1;
+ float _EmissionScrollingUseCurve1;
+ float _EmissionReplace1;
+ float _EmissionColor1ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL1Enabled;
+ float2 _EmissionAL1StrengthMod;
+ float _EmissionAL1StrengthBand;
+ float2 _AudioLinkEmission1CenterOut;
+ float _AudioLinkEmission1CenterOutSize;
+ float _AudioLinkEmission1CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_2
+
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap2;
+ #endif
+ float4 _EmissionMap2_ST;
+ float2 _EmissionMap2Pan;
+ float _EmissionMap2UV;
+ #if defined(PROP_EMISSIONMASK2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask2;
+ #endif
+ float4 _EmissionMask2_ST;
+ float2 _EmissionMask2Pan;
+ float _EmissionMask2UV;
+ float _EmissionMaskInvert2;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve2;
+ #endif
+ float4 _EmissionScrollingCurve2_ST;
+
+ float4 _EmissionColor2;
+ float _EmissionBaseColorAsMap2;
+ float _EmissionStrength2;
+ float _EnableEmission2;
+ float _EmissionHueShift2;
+ float _EmissionHueShiftSpeed2;
+ float4 _EmissiveScroll_Direction2;
+ float _EmissiveScroll_Width2;
+ float _EmissiveScroll_Velocity2;
+ float _EmissiveScroll_Interval2;
+ float _EmissionBlinkingEnabled2;
+ float _EmissiveBlink_Min2;
+ float _EmissiveBlink_Max2;
+ float _EmissiveBlink_Velocity2;
+ float _ScrollingEmission2;
+ float _EnableGITDEmission2;
+ float _GITDEMinEmissionMultiplier2;
+ float _GITDEMaxEmissionMultiplier2;
+ float _GITDEMinLight2;
+ float _GITDEMaxLight2;
+ float _GITDEWorldOrMesh2;
+ float _EmissionCenterOutEnabled2;
+ float _EmissionCenterOutSpeed2;
+ float _EmissionHueShiftEnabled2;
+ float _EmissionBlinkingOffset2;
+ float _EmissionScrollingOffset2;
+ float _EmissionScrollingVertexColor2;
+ float _EmissionScrollingUseCurve2;
+ float _EmissionReplace2;
+ float _EmissionColor2ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL2Enabled;
+ float2 _EmissionAL2StrengthMod;
+ float _EmissionAL2StrengthBand;
+ float2 _AudioLinkEmission2CenterOut;
+ float _AudioLinkEmission2CenterOutSize;
+ float _AudioLinkEmission2CenterOutBand;
+ #endif
+
+ #ifdef POI_EMISSION_3
+
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMap3;
+ #endif
+ float4 _EmissionMap3_ST;
+ float2 _EmissionMap3Pan;
+ float _EmissionMap3UV;
+ #if defined(PROP_EMISSIONMASK3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionMask3;
+ #endif
+ float4 _EmissionMask3_ST;
+ float2 _EmissionMask3Pan;
+ float _EmissionMask3UV;
+ float _EmissionMaskInvert3;
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _EmissionScrollingCurve3;
+ #endif
+ float4 _EmissionScrollingCurve3_ST;
+
+ float4 _EmissionColor3;
+ float _EmissionBaseColorAsMap3;
+ float _EmissionStrength3;
+ float _EnableEmission3;
+ float _EmissionHueShift3;
+ float _EmissionHueShiftSpeed3;
+ float4 _EmissiveScroll_Direction3;
+ float _EmissiveScroll_Width3;
+ float _EmissiveScroll_Velocity3;
+ float _EmissiveScroll_Interval3;
+ float _EmissionBlinkingEnabled3;
+ float _EmissiveBlink_Min3;
+ float _EmissiveBlink_Max3;
+ float _EmissiveBlink_Velocity3;
+ float _ScrollingEmission3;
+ float _EnableGITDEmission3;
+ float _GITDEMinEmissionMultiplier3;
+ float _GITDEMaxEmissionMultiplier3;
+ float _GITDEMinLight3;
+ float _GITDEMaxLight3;
+ float _GITDEWorldOrMesh3;
+ float _EmissionCenterOutEnabled3;
+ float _EmissionCenterOutSpeed3;
+ float _EmissionHueShiftEnabled3;
+ float _EmissionBlinkingOffset3;
+ float _EmissionScrollingOffset3;
+ float _EmissionScrollingVertexColor3;
+ float _EmissionScrollingUseCurve3;
+ float _EmissionReplace3;
+ float _EmissionColor3ThemeIndex;
+
+ // Audio Link
+ float _EmissionAL3Enabled;
+ float2 _EmissionAL3StrengthMod;
+ float _EmissionAL3StrengthBand;
+ float2 _AudioLinkEmission3CenterOut;
+ float _AudioLinkEmission3CenterOutSize;
+ float _AudioLinkEmission3CenterOutBand;
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ float _PPLightingMultiplier;
+ float _PPLightingAddition;
+ float _PPEmissionMultiplier;
+ float _PPFinalColorMultiplier;
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ float calculateGlowInTheDark(in float minLight, in float maxLight, in float minEmissionMultiplier, in float maxEmissionMultiplier, in float enabled, in float worldOrMesh, in PoiLight poiLight)
+ {
+ float glowInTheDarkMultiplier = 1;
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ float3 lightValue = worldOrMesh ? calculateluminance(poiLight.finalLighting.rgb) : calculateluminance(poiLight.directColor.rgb);
+ float gitdeAlpha = saturate(inverseLerp(minLight, maxLight, lightValue));
+ glowInTheDarkMultiplier = lerp(minEmissionMultiplier, maxEmissionMultiplier, gitdeAlpha);
+ }
+ return glowInTheDarkMultiplier;
+ }
+
+ float calculateScrollingEmission(in float3 direction, in float velocity, in float interval, in float scrollWidth, float offset, float3 position)
+ {
+ scrollWidth = max(scrollWidth, 0);
+ float phase = 0;
+ phase = dot(position, direction);
+ phase -= (_Time.y + offset) * velocity;
+ phase /= interval;
+ phase -= floor(phase);
+ 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 float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionStrengthMod.x, emissionStrengthMod.y, poiMods.audioLink[emissionStrengthBand]);
+ }
+ #endif
+ }
+
+ void applyALCenterOutEmission(in PoiMods poiMods, in float nDotV, inout float emissionStrength, in float size, in float band, in float2 emissionToAdd, in float enabled)
+ {
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && enabled)
+ {
+ emissionStrength += lerp(emissionToAdd.x, emissionToAdd.y, getBandAtTime(band, saturate(1 - nDotV), size));
+ }
+ #endif
+ }
+
+ #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;
+
+ float glowInTheDarkMultiplier0 = calculateGlowInTheDark(_GITDEMinLight, _GITDEMaxLight, _GITDEMinEmissionMultiplier, _GITDEMaxEmissionMultiplier, _EnableGITDEmission, _GITDEWorldOrMesh, poiLight);
+
+ #if defined(PROP_EMISSIONMAP) || !defined(OPTIMIZER_ENABLED)
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled)
+ {
+ emissionColor0 = POI2D_SAMPLER_PAN(_EmissionMap, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionMap_ST), _EmissionMapPan).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ else
+ {
+ emissionColor0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap_ST.xy) + _Time.x * _EmissionCenterOutSpeed).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ }
+ #else
+ emissionColor0 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap).rgb * poiThemeColor(poiMods, _EmissionColor.rgb, _EmissionColorThemeIndex);
+ #endif
+
+ //UNITY_BRANCH
+ if (_ScrollingEmission)
+ {
+ float3 pos = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor)
+ {
+ pos = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength0 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve, _MainTex, poiUV(poiMesh.uv[_EmissionMapUV], _EmissionScrollingCurve_ST) + (dot(pos, _EmissiveScroll_Direction.xyz) * _EmissiveScroll_Interval) + _Time.x * _EmissiveScroll_Velocity).r;
+ #endif
+ }
+ else
+ {
+ 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);
+
+ #if defined(PROP_EMISSIONMASK) || !defined(OPTIMIZER_ENABLED)
+ float emissionMask0 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMask, _MainTex, poiUV(poiMesh.uv[_EmissionMaskUV], _EmissionMask_ST) + _Time.x * _EmissionMaskPan).r;
+ #else
+ float emissionMask0 = 1;
+ #endif
+
+ if (_EmissionMaskInvert)
+ {
+ emissionMask0 = 1 - emissionMask0;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission != 4)
+ {
+ emissionMask0 *= blackLightMask[_BlackLightMaskEmission];
+ }
+ #endif
+
+ applyALEmmissionStrength(poiMods, emissionStrength0, _EmissionAL0StrengthMod, _EmissionAL0StrengthBand, _EmissionAL0Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength0, _AudioLinkEmission0CenterOutSize, _AudioLinkEmission0CenterOutBand, _AudioLinkEmission0CenterOut, _EmissionAL0Enabled);
+
+ emissionStrength0 *= glowInTheDarkMultiplier0 * emissionMask0;
+ emission0 = max(emissionStrength0 * emissionColor0, 0);
+
+ #ifdef POI_DISSOLVE
+ //UNITY_BRANCH
+ if (_DissolveEmissionSide != 2)
+ {
+ 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;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier1 = calculateGlowInTheDark(_GITDEMinLight1, _GITDEMaxLight1, _GITDEMinEmissionMultiplier1, _GITDEMaxEmissionMultiplier1, _EnableGITDEmission1, _GITDEWorldOrMesh1, poiLight);
+ #if defined(PROP_EMISSIONMAP1) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled1)
+ {
+ emissionColor1 = POI2D_SAMPLER_PAN(_EmissionMap1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionMap1_ST), _EmissionMap1Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ else
+ {
+ emissionColor1 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap1, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap1_ST.xy) + _Time.x * _EmissionCenterOutSpeed1).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ }
+ #else
+ emissionColor1 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap1).rgb * poiThemeColor(poiMods, _EmissionColor1.rgb, _EmissionColor1ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission1)
+ {
+ float3 pos1 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor1)
+ {
+ pos1 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve1)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE1) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength1 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve1, _MainTex, poiUV(poiMesh.uv[_EmissionMap1UV], _EmissionScrollingCurve1_ST) + (dot(pos1, _EmissiveScroll_Direction1) * _EmissiveScroll_Interval1) + _Time.x * _EmissiveScroll_Velocity1);
+ #endif
+ }
+ else
+ {
+ emissionStrength1 *= calculateScrollingEmission(_EmissiveScroll_Direction1, _EmissiveScroll_Velocity1, _EmissiveScroll_Interval1, _EmissiveScroll_Width1, _EmissionScrollingOffset1, pos1);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled1)
+ {
+ emissionStrength1 *= calculateBlinkingEmission(_EmissiveBlink_Min1, _EmissiveBlink_Max1, _EmissiveBlink_Velocity1, _EmissionBlinkingOffset1);
+ }
+
+ emissionColor1 = hueShift(emissionColor1, frac(_EmissionHueShift1 + _EmissionHueShiftSpeed1 * _Time.x) * _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);
+ #else
+ float emissionMask1 = 1;
+ #endif
+
+ if (_EmissionMaskInvert1)
+ {
+ emissionMask1 = 1 - emissionMask1;
+ }
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskEmission2 != 4)
+ {
+ emissionMask1 *= blackLightMask[_BlackLightMaskEmission2];
+ }
+ #endif
+ applyALEmmissionStrength(poiMods, emissionStrength1, _EmissionAL1StrengthMod, _EmissionAL1StrengthBand, _EmissionAL1Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength1, _AudioLinkEmission1CenterOutSize, _AudioLinkEmission1CenterOutBand, _AudioLinkEmission1CenterOut, _EmissionAL1Enabled);
+
+ emissionStrength1 *= glowInTheDarkMultiplier1 * emissionMask1;
+ emission1 = max(emissionStrength1 * emissionColor1, 0);
+
+ poiFragData.emission += emission1;
+ return emission1 * _EmissionReplace1;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier2 = calculateGlowInTheDark(_GITDEMinLight2, _GITDEMaxLight2, _GITDEMinEmissionMultiplier2, _GITDEMaxEmissionMultiplier2, _EnableGITDEmission2, _GITDEWorldOrMesh2, poiLight);
+ #if defined(PROP_EMISSIONMAP2) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled2)
+ {
+ emissionColor2 = POI2D_SAMPLER_PAN(_EmissionMap2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionMap2_ST), _EmissionMap2Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ else
+ {
+ emissionColor2 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap2, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap2_ST.xy) + _Time.x * _EmissionCenterOutSpeed2).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ }
+ #else
+ emissionColor2 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap2).rgb * poiThemeColor(poiMods, _EmissionColor2.rgb, _EmissionColor2ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission2)
+ {
+ float3 pos2 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor2)
+ {
+ pos2 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve2)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE2) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength2 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve2, _MainTex, poiUV(poiMesh.uv[_EmissionMap2UV], _EmissionScrollingCurve2_ST) + (dot(pos2, _EmissiveScroll_Direction2) * _EmissiveScroll_Interval2) + _Time.x * _EmissiveScroll_Velocity2);
+ #endif
+ }
+ else
+ {
+ emissionStrength2 *= calculateScrollingEmission(_EmissiveScroll_Direction2, _EmissiveScroll_Velocity2, _EmissiveScroll_Interval2, _EmissiveScroll_Width2, _EmissionScrollingOffset2, pos2);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled2)
+ {
+ emissionStrength2 *= calculateBlinkingEmission(_EmissiveBlink_Min2, _EmissiveBlink_Max2, _EmissiveBlink_Velocity2, _EmissionBlinkingOffset2);
+ }
+
+ emissionColor2 = hueShift(emissionColor2, frac(_EmissionHueShift2 + _EmissionHueShiftSpeed2 * _Time.x) * _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);
+ #else
+ float emissionMask2 = 1;
+ #endif
+ if (_EmissionMaskInvert2)
+ {
+ emissionMask2 = 1 - emissionMask2;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask2 *= blackLightMask[_BlackLightMaskEmission2];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength2, _EmissionAL2StrengthMod, _EmissionAL2StrengthBand, _EmissionAL2Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength2, _AudioLinkEmission2CenterOutSize, _AudioLinkEmission2CenterOutBand, _AudioLinkEmission2CenterOut, _EmissionAL2Enabled);
+ emissionStrength2 *= glowInTheDarkMultiplier2 * emissionMask2;
+ emission2 = max(emissionStrength2 * emissionColor2, 0);
+
+ poiFragData.emission += emission2;
+ return emission2 * _EmissionReplace2;
+ }
+ #endif
+
+ #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;
+
+ float glowInTheDarkMultiplier3 = calculateGlowInTheDark(_GITDEMinLight3, _GITDEMaxLight3, _GITDEMinEmissionMultiplier3, _GITDEMaxEmissionMultiplier3, _EnableGITDEmission3, _GITDEWorldOrMesh3, poiLight);
+ #if defined(PROP_EMISSIONMAP3) || !defined(OPTIMIZER_ENABLED)
+
+ //UNITY_BRANCH
+ if (!_EmissionCenterOutEnabled3)
+ {
+ emissionColor3 = POI2D_SAMPLER_PAN(_EmissionMap3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionMap3_ST), _EmissionMap3Pan) * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ else
+ {
+ emissionColor3 = UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionMap3, _MainTex, ((.5 + poiLight.nDotV * .5) * _EmissionMap3_ST.xy) + _Time.x * _EmissionCenterOutSpeed3).rgb * lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ }
+ #else
+ emissionColor3 = lerp(1, poiFragData.baseColor, _EmissionBaseColorAsMap3).rgb * poiThemeColor(poiMods, _EmissionColor3.rgb, _EmissionColor3ThemeIndex);
+ #endif
+ //UNITY_BRANCH
+ if (_ScrollingEmission3)
+ {
+ float3 pos3 = poiMesh.localPos;
+ //UNITY_BRANCH
+ if (_EmissionScrollingVertexColor3)
+ {
+ pos3 = poiMesh.vertexColor.rgb;
+ }
+
+ //UNITY_BRANCH
+ if (_EmissionScrollingUseCurve3)
+ {
+ #if defined(PROP_EMISSIONSCROLLINGCURVE3) || !defined(OPTIMIZER_ENABLED)
+ emissionStrength3 *= UNITY_SAMPLE_TEX2D_SAMPLER(_EmissionScrollingCurve3, _MainTex, poiUV(poiMesh.uv[_EmissionMap3UV], _EmissionScrollingCurve3_ST) + (dot(pos3, _EmissiveScroll_Direction3) * _EmissiveScroll_Interval3) + _Time.x * _EmissiveScroll_Velocity3);
+ #endif
+ }
+ else
+ {
+ emissionStrength3 *= calculateScrollingEmission(_EmissiveScroll_Direction3, _EmissiveScroll_Velocity3, _EmissiveScroll_Interval3, _EmissiveScroll_Width3, _EmissionScrollingOffset3, pos3);
+ }
+ }
+ //UNITY_BRANCH
+ if (_EmissionBlinkingEnabled3)
+ {
+ emissionStrength3 *= calculateBlinkingEmission(_EmissiveBlink_Min3, _EmissiveBlink_Max3, _EmissiveBlink_Velocity3, _EmissionBlinkingOffset3);
+ }
+
+ emissionColor3 = hueShift(emissionColor3, frac(_EmissionHueShift3 + _EmissionHueShiftSpeed3 * _Time.x) * _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);
+ #else
+ float emissionMask3 = 1;
+ #endif
+
+ if (_EmissionMaskInvert3)
+ {
+ emissionMask3 = 1 - emissionMask3;
+ }
+ // #ifdef POI_BLACKLIGHT
+ // if (_BlackLightMaskEmission3 != 4)
+ // {
+ // emissionMask3 *= blackLightMask[_BlackLightMaskEmission3];
+ // }
+ // #endif
+ applyALEmmissionStrength(poiMods, emissionStrength3, _EmissionAL3StrengthMod, _EmissionAL3StrengthBand, _EmissionAL3Enabled);
+ applyALCenterOutEmission(poiMods, poiLight.nDotV, emissionStrength3, _AudioLinkEmission3CenterOutSize, _AudioLinkEmission3CenterOutBand, _AudioLinkEmission3CenterOut, _EmissionAL3Enabled);
+ emissionStrength3 *= glowInTheDarkMultiplier3 * emissionMask3;
+ emission3 = max(emissionStrength3 * emissionColor3, 0);
+
+ poiFragData.emission += emission3;
+ return emission3 * _EmissionReplace3;
+ }
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ /*
+ #ifdef
+ , out float depth : SV_DEPTH
+ #endif
+ */
+ {
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ UNITY_BRANCH
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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 defined(_EMISSION) || defined(POI_EMISSION_1) || defined(POI_EMISSION_2) || defined(POI_EMISSION_3)
+ float3 emissionBaseReplace = 0;
+ #endif
+
+ #ifdef _EMISSION
+ emissionBaseReplace += applyEmission(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_1
+ emissionBaseReplace += applyEmission1(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_2
+ emissionBaseReplace += applyEmission2(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+ #ifdef POI_EMISSION_3
+ emissionBaseReplace += applyEmission3(poiFragData, poiMesh, poiLight, poiCam, poiMods);
+ #endif
+
+ #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
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ poiFragData.finalColor += poiLight.finalLightAdd;
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ poiFragData.emission = max(poiFragData.emission * _PPEmissionMultiplier, 0);
+ poiFragData.finalColor = max(poiFragData.finalColor * _PPFinalColorMultiplier, 0);
+ #endif
+
+ #ifdef POSTPROCESS
+ applyPostProcessing(poiFragData, poiMesh);
+ #endif
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor + poiFragData.emission * poiMods.globalEmission, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite Off
+ Cull [_Cull]
+ AlphaToMask [_AlphaToCoverage]
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_AddBlendOp], [_AddBlendOpAlpha]
+ Blend [_AddSrcBlend] [_AddDstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ float4 _GlobalThemeColor0;
+ float4 _GlobalThemeColor1;
+ float4 _GlobalThemeColor2;
+ float4 _GlobalThemeColor3;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingAOMaps;
+ #endif
+ float4 _LightingAOMaps_ST;
+ float2 _LightingAOMapsPan;
+ float _LightingAOMapsUV;
+ float _LightDataAOStrengthR;
+ float _LightDataAOStrengthG;
+ float _LightDataAOStrengthB;
+ float _LightDataAOStrengthA;
+
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingDetailShadowMaps;
+ #endif
+ float4 _LightingDetailShadowMaps_ST;
+ float2 _LightingDetailShadowMapsPan;
+ float _LightingDetailShadowMapsUV;
+ float _LightingDetailShadowStrengthR;
+ float _LightingDetailShadowStrengthG;
+ float _LightingDetailShadowStrengthB;
+ float _LightingDetailShadowStrengthA;
+
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _LightingShadowMasks;
+ #endif
+ float4 _LightingShadowMasks_ST;
+ float2 _LightingShadowMasksPan;
+ float _LightingShadowMasksUV;
+ float _LightingShadowMaskStrengthR;
+ float _LightingShadowMaskStrengthG;
+ float _LightingShadowMaskStrengthB;
+ float _LightingShadowMaskStrengthA;
+
+ // Lighting Data
+ float _Unlit_Intensity;
+ float _LightingColorMode;
+ float _LightingMapMode;
+ float _LightingDirectionMode;
+ float3 _LightngForcedDirection;
+ float _LightingIndirectUsesNormals;
+ float _LightingCapEnabled;
+ float _LightingCap;
+ float _LightingForceColorEnabled;
+ float3 _LightingForcedColor;
+ float _LightingForcedColorThemeIndex;
+ float _LightingCastedShadows;
+ float _LightingMonochromatic;
+ float _LightingAdditiveMonochromatic;
+ float _LightingMinLightBrightness;
+ // Additive Lighting Data
+ float _LightingAdditiveLimited;
+ float _LightingAdditiveLimit;
+ float _LightingAdditivePassthrough;
+ // Lighting Data Debug
+ float _LightingDebugVisualize;
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef FINALPASS
+ #if defined(PROP_DETAILMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailMask;
+ #endif
+ float4 _DetailMask_ST;
+ float2 _DetailMaskPan;
+ float _DetailMaskUV;
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailNormalMap;
+ #endif
+ float4 _DetailNormalMap_ST;
+ float2 _DetailNormalMapPan;
+ float _DetailNormalMapUV;
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DetailTex;
+ #endif
+ float4 _DetailTex_ST;
+ float2 _DetailTexPan;
+ float _DetailTexUV;
+
+ float3 _DetailTint;
+ float _DetailTintThemeIndex;
+ float _DetailTexIntensity;
+ float _DetailBrightness;
+ float _DetailNormalMapScale;
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef VIGNETTE
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RGBMask;
+ #endif
+ float4 _RGBMask_ST;
+ float2 _RGBMaskPan;
+ float _RGBMaskUV;
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RedTexture;
+ #endif
+ float4 _RedTexture_ST;
+ float2 _RedTexturePan;
+ float _RedTextureUV;
+
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GreenTexture;
+ #endif
+ float4 _GreenTexture_ST;
+ float2 _GreenTexturePan;
+ float _GreenTextureUV;
+
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _BlueTexture;
+ #endif
+ float4 _BlueTexture_ST;
+ float2 _BlueTexturePan;
+ float _BlueTextureUV;
+
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AlphaTexture;
+ #endif
+ float4 _AlphaTexture_ST;
+ float2 _AlphaTexturePan;
+ float _AlphaTextureUV;
+
+ #ifdef GEOM_TYPE_MESH
+ #if defined(PROP_RGBNORMALR) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalR;
+ float4 _RgbNormalR_ST;
+ float2 _RgbNormalRPan;
+ float _RgbNormalRUV;
+ float _RgbNormalRScale;
+
+ #if defined(PROP_RGBNORMALG) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalG;
+ float4 _RgbNormalG_ST;
+ float2 _RgbNormalGPan;
+ float _RgbNormalGUV;
+ float _RgbNormalGScale;
+
+ #if defined(PROP_RGBNORMALB) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalB;
+ float4 _RgbNormalB_ST;
+ float2 _RgbNormalBPan;
+ float _RgbNormalBUV;
+ float _RgbNormalBScale;
+
+ #if defined(PROP_RGBNORMALA) || !defined(OPTIMIZER_ENABLED)
+ #endif
+ Texture2D _RgbNormalA;
+ float4 _RgbNormalA_ST;
+ float2 _RgbNormalAPan;
+ float _RgbNormalAUV;
+ float _RgbNormalAScale;
+
+ float _RgbNormalsEnabled;
+ #endif
+
+ float4 _RedColor;
+ float4 _GreenColor;
+ float4 _BlueColor;
+ float4 _AlphaColor;
+
+ float _RedColorThemeIndex;
+ float _GreenColorThemeIndex;
+ float _BlueColorThemeIndex;
+ float _AlphaColorThemeIndex;
+
+ float _RGBBlendMultiplicative;
+ float _RGBUseVertexColors;
+ float _RGBNormalBlend;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DecalMask;
+ float4 _DecalMask_ST;
+ float2 _DecalMaskPan;
+ float _DecalMaskUV;
+ #endif
+ float _DecalTPSDepthMaskEnabled;
+ float _Decal0TPSMaskStrength;
+ float _Decal1TPSMaskStrength;
+ float _Decal2TPSMaskStrength;
+ float _Decal3TPSMaskStrength;
+
+ #ifdef POI_AUDIOLINK
+ // Audio Link
+ half _AudioLinkDecal0ScaleBand;
+ float4 _AudioLinkDecal0Scale;
+ half _AudioLinkDecal0RotationBand;
+ float2 _AudioLinkDecal0Rotation;
+ half _AudioLinkDecal0AlphaBand;
+ float2 _AudioLinkDecal0Alpha;
+ half _AudioLinkDecal0EmissionBand;
+ float2 _AudioLinkDecal0Emission;
+ //todo
+ float _DecalRotationCTALBand0;
+ float _DecalRotationCTALSpeed0;
+ float _DecalRotationCTALType0;
+ //todo
+ float _AudioLinkDecalCC0;
+ //todo
+ float _AudioLinkDecal0SideBand;
+ float4 _AudioLinkDecal0SideMin;
+ float4 _AudioLinkDecal0SideMax;
+
+ half _AudioLinkDecal1ScaleBand;
+ float4 _AudioLinkDecal1Scale;
+ half _AudioLinkDecal1RotationBand;
+ float2 _AudioLinkDecal1Rotation;
+ half _AudioLinkDecal1AlphaBand;
+ float2 _AudioLinkDecal1Alpha;
+ half _AudioLinkDecal1EmissionBand;
+ float2 _AudioLinkDecal1Emission;
+ //todo
+ float _DecalRotationCTALBand1;
+ float _DecalRotationCTALSpeed1;
+ float _DecalRotationCTALType1;
+ //todo
+ float _AudioLinkDecalCC1;
+ //todo
+ float _AudioLinkDecal1SideBand;
+ float4 _AudioLinkDecal1SideMin;
+ float4 _AudioLinkDecal1SideMax;
+
+ half _AudioLinkDecal2ScaleBand;
+ float4 _AudioLinkDecal2Scale;
+ half _AudioLinkDecal2RotationBand;
+ float2 _AudioLinkDecal2Rotation;
+ half _AudioLinkDecal2AlphaBand;
+ float2 _AudioLinkDecal2Alpha;
+ half _AudioLinkDecal2EmissionBand;
+ float2 _AudioLinkDecal2Emission;
+ //todo
+ float _DecalRotationCTALBand2;
+ float _DecalRotationCTALSpeed2;
+ float _DecalRotationCTALType2;
+ //todo
+ float _AudioLinkDecalCC2;
+ //todo
+ float _AudioLinkDecal2SideBand;
+ float4 _AudioLinkDecal2SideMin;
+ float4 _AudioLinkDecal2SideMax;
+
+ half _AudioLinkDecal3ScaleBand;
+ float4 _AudioLinkDecal3Scale;
+ half _AudioLinkDecal3RotationBand;
+ float2 _AudioLinkDecal3Rotation;
+ half _AudioLinkDecal3AlphaBand;
+ float2 _AudioLinkDecal3Alpha;
+ half _AudioLinkDecal3EmissionBand;
+ float2 _AudioLinkDecal3Emission;
+ float _DecalRotationCTALBand3;
+ float _DecalRotationCTALSpeed3;
+ float _DecalRotationCTALType3;
+ float _AudioLinkDecalCC3;
+ float _AudioLinkDecal3SideBand;
+ float4 _AudioLinkDecal3SideMin;
+ float4 _AudioLinkDecal3SideMax;
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH
+ float _Decal0MaskChannel;
+ sampler2D _DecalTexture;
+ float4 _DecalTexture_ST;
+ float2 _DecalTexturePan;
+ float _DecalTextureUV;
+
+ float4 _DecalColor;
+ float _DecalColorThemeIndex;
+ fixed _DecalTiled;
+ float _DecalBlendType;
+ half _DecalRotation;
+ half2 _DecalScale;
+ float4 _DecalSideOffset;
+ half2 _DecalPosition;
+ half _DecalRotationSpeed;
+ float _DecalEmissionStrength;
+ float _DecalBlendAlpha;
+ float _DecalOverrideAlpha;
+ float _DecalHueShiftEnabled;
+ float _DecalHueShift;
+ float _DecalHueShiftSpeed;
+ float _Decal0Depth;
+ float _Decal0HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ float _Decal1MaskChannel;
+ sampler2D _DecalTexture1;
+ float4 _DecalTexture1_ST;
+ float2 _DecalTexture1Pan;
+ float _DecalTexture1UV;
+
+ float4 _DecalColor1;
+ float _DecalColor1ThemeIndex;
+ fixed _DecalTiled1;
+ float _DecalBlendType1;
+ half _DecalRotation1;
+ half2 _DecalScale1;
+ float4 _DecalSideOffset1;
+ half2 _DecalPosition1;
+ half _DecalRotationSpeed1;
+ float _DecalEmissionStrength1;
+ float _DecalBlendAlpha1;
+ float _DecalOverrideAlpha1;
+ float _DecalHueShiftEnabled1;
+ float _DecalHueShift1;
+ float _DecalHueShiftSpeed1;
+ float _Decal1Depth;
+ float _Decal1HueAngleStrength;
+
+ #endif
+
+ #ifdef GEOM_TYPE_FROND
+ float _Decal2MaskChannel;
+ sampler2D _DecalTexture2;
+ float4 _DecalTexture2_ST;
+ float2 _DecalTexture2Pan;
+ float _DecalTexture2UV;
+ float4 _DecalColor2;
+ float _DecalColor2ThemeIndex;
+ fixed _DecalTiled2;
+ float _DecalBlendType2;
+ half _DecalRotation2;
+ half2 _DecalScale2;
+ float4 _DecalSideOffset2;
+ half2 _DecalPosition2;
+ half _DecalRotationSpeed2;
+ float _DecalEmissionStrength2;
+ float _DecalBlendAlpha2;
+ float _DecalOverrideAlpha2;
+ float _DecalHueShiftEnabled2;
+ float _DecalHueShift2;
+ float _DecalHueShiftSpeed2;
+ float _Decal2Depth;
+ float _Decal2HueAngleStrength;
+
+ #endif
+
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ float _Decal3MaskChannel;
+ sampler2D _DecalTexture3;
+ float4 _DecalTexture3_ST;
+ float2 _DecalTexture3Pan;
+ float _DecalTexture3UV;
+ float4 _DecalColor3;
+ float _DecalColor3ThemeIndex;
+ fixed _DecalTiled3;
+ float _DecalBlendType3;
+ half _DecalRotation3;
+ half2 _DecalScale3;
+ float4 _DecalSideOffset3;
+ half2 _DecalPosition3;
+ half _DecalRotationSpeed3;
+ float _DecalEmissionStrength3;
+ float _DecalBlendAlpha3;
+ float _DecalOverrideAlpha3;
+ float _DecalHueShiftEnabled3;
+ float _DecalHueShift3;
+ float _DecalHueShiftSpeed3;
+ float _Decal3Depth;
+ float _Decal3HueAngleStrength;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ // Toon Lighting
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ UNITY_DECLARE_TEX2D(_ToonRamp);
+ #endif
+ float _ShadowOffset;
+ float _ShadowStrength;
+ float _LightingIgnoreAmbientColor;
+ // Math Toon Lighting
+ float _LightingGradientStart;
+ float _LightingGradientEnd;
+ float3 _LightingShadowColor;
+ float _LightingGradientStartWrap;
+ float _LightingGradientEndWrap;
+ // ShadeMap Lighting
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ float3 _1st_ShadeColor;
+ #if defined(PROP_1ST_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _1st_ShadeMap;
+ #endif
+ float4 _1st_ShadeMap_ST;
+ float2 _1st_ShadeMapPan;
+ float _1st_ShadeMapUV;
+ float _Use_1stShadeMapAlpha_As_ShadowMask;
+ float _1stShadeMapMask_Inverse;
+ float _Use_BaseAs1st;
+ float3 _2nd_ShadeColor;
+ #if defined(PROP_2ND_SHADEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _2nd_ShadeMap;
+ #endif
+ float4 _2nd_ShadeMap_ST;
+ float2 _2nd_ShadeMapPan;
+ float _2nd_ShadeMapUV;
+ float _Use_2ndShadeMapAlpha_As_ShadowMask;
+ float _2ndShadeMapMask_Inverse;
+ float _Use_1stAs2nd;
+ float _BaseColor_Step;
+ float _BaseShade_Feather;
+ float _ShadeColor_Step;
+ float _1st2nd_Shades_Feather;
+ float _ShadingShadeMapBlendType;
+ #endif
+ // Skin
+ sampler2D _SkinLUT;
+ float _SssScale;
+ float _SssBumpBlur;
+ float3 _SssTransmissionAbsorption;
+ float3 _SssColorBleedAoWeights;
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+ float4 _ShadowColor;
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ShadowColorTex;
+ float4 _ShadowColorTex_ST;
+ float2 _ShadowColorTexPan;
+ float _ShadowColorTexUV;
+ #endif
+ float _ShadowBorder;
+ float _ShadowBlur;
+ float4 _Shadow2ndColor;
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow2ndColorTex;
+ float4 _Shadow2ndColorTex_ST;
+ float2 _Shadow2ndColorTexPan;
+ float _Shadow2ndColorTexUV;
+ #endif
+ float _Shadow2ndBorder;
+ float _Shadow2ndBlur;
+ float4 _Shadow3rdColor;
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Shadow3rdColorTex;
+ float4 _Shadow3rdColorTex_ST;
+ float2 _Shadow3rdColorTexPan;
+ float _Shadow3rdColorTexUV;
+ #endif
+ float _Shadow3rdBorder;
+ float _Shadow3rdBlur;
+ float4 _ShadowBorderColor;
+ float _ShadowBorderRange;
+ #endif
+
+ // Cloth
+ #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 _ClothMetallic;
+ float _ClothReflectance;
+ float _ClothSmoothness;
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _SDFShadingTexture;
+ float _SDFShadingTextureUV;
+ float2 _SDFShadingTexturePan;
+ float4 _SDFShadingTexture_ST;
+ #endif
+ #endif
+ // Additive
+ float _LightingAdditiveType;
+ float _LightingAdditiveGradientStart;
+ float _LightingAdditiveGradientEnd;
+ float _LightingAdditiveDetailStrength;
+
+ #ifdef POI_ANISOTROPICS
+
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoColorMap;
+ float4 _AnisoColorMap_ST;
+ float2 _AnisoColorMapPan;
+ float _AnisoColorMapUV;
+ #endif
+ /*
+ #if defined(PROP_ANISONOISEMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _AnisoNoiseMap;
+ float4 _AnisoNoiseMap_ST;
+ float2 _AnisoNoiseMapPan;
+ float _AnisoNoiseMapUV;
+ #endif
+ */
+ float _AnisoHideInShadow;
+ float _AnisoReplace;
+ float _AnisoAdd;
+ float _AnisoUseBaseColor;
+ float _AnisoUseLightColor;
+
+ float _Aniso0Strength;
+ float _Aniso0Power;
+ float _Aniso0Offset;
+ float4 _Aniso0Tint;
+ float _Aniso0TintIndex;
+ float _Aniso0OffsetMapStrength;
+ float _Aniso0ToonMode;
+ float _Aniso0Edge;
+ float _Aniso0Blur;
+
+ float _Aniso1Strength;
+ float _Aniso1Power;
+ float _Aniso1Offset;
+ float4 _Aniso1Tint;
+ float _Aniso1TintIndex;
+ float _Aniso1OffsetMapStrength;
+ float _Aniso1ToonMode;
+ float _Aniso1Edge;
+ float _Aniso1Blur;
+
+ float _AnisoDebugMode;
+ #endif
+
+ #ifdef POI_MATCAP0
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap;
+ float4 _Matcap_ST;
+ float2 _MatcapPan;
+ float _MatcapUV;
+ #endif
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MatcapMask;
+ float4 _MatcapMask_ST;
+ float2 _MatcapMaskPan;
+ float _MatcapMaskUV;
+ #endif
+ #ifdef POI_MATCAP0_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP0NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap0NormalMap;
+ #endif
+ float4 _Matcap0NormalMap_ST;
+ float2 _Matcap0NormalMapPan;
+ float _Matcap0NormalMapUV;
+ float _Matcap0NormalMapScale;
+ #endif
+ float _MatcapUVMode;
+ float _MatcapMaskInvert;
+ float _MatcapBorder;
+ float4 _MatcapColor;
+ float _MatcapColorThemeIndex;
+ float _MatcapIntensity;
+ float _MatcapReplace;
+ float _MatcapMultiply;
+ float _MatcapAdd;
+ float _MatcapAddToLight;
+ float _MatcapMixed;
+ float _MatcapAlphaOverride;
+ float _MatcapEnable;
+ float _MatcapLightMask;
+ float _MatcapEmissionStrength;
+ float _MatcapNormal;
+ float _MatcapHueShiftEnabled;
+ float _MatcapHueShiftSpeed;
+ float _MatcapHueShift;
+ float _MatcapTPSDepthEnabled;
+ float _MatcapTPSMaskStrength;
+ #endif
+
+ #ifdef COLOR_GRADING_HDR_3D
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2;
+ float4 _Matcap2_ST;
+ float2 _Matcap2Pan;
+ float _Matcap2UV;
+ #endif
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap2Mask;
+ float4 _Matcap2Mask_ST;
+ float2 _Matcap2MaskPan;
+ float _Matcap2MaskUV;
+ #endif
+ #ifdef POI_MATCAP1_CUSTOM_NORMAL
+ #if defined(PROP_MATCAP1NORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Matcap1NormalMap;
+ #endif
+ float4 _Matcap1NormalMap_ST;
+ float2 _Matcap1NormalMapPan;
+ float _Matcap1NormalMapUV;
+ float _Matcap1NormalMapScale;
+ #endif
+ float _Matcap2UVMode;
+ float _Matcap2MaskInvert;
+ float _Matcap2Border;
+ float4 _Matcap2Color;
+ float _Matcap2ColorThemeIndex;
+ float _Matcap2Intensity;
+ float _Matcap2Replace;
+ float _Matcap2Multiply;
+ float _Matcap2Add;
+ float _Matcap2AddToLight;
+ float _Matcap2Mixed;
+ float _Matcap2AlphaOverride;
+ float _Matcap2Enable;
+ float _Matcap2LightMask;
+ float _Matcap2EmissionStrength;
+ float _Matcap2Normal;
+ float _Matcap2HueShiftEnabled;
+ float _Matcap2HueShiftSpeed;
+ float _Matcap2HueShift;
+ float _Matcap2TPSDepthEnabled;
+ float _Matcap2TPSMaskStrength;
+ #endif
+
+ #ifdef _CUBEMAP
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ samplerCUBE _CubeMap;
+ #endif
+ #if defined(PROP_CUBEMAPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _CubeMapMask;
+ float4 _CubeMapMask_ST;
+ float2 _CubeMapMaskPan;
+ float _CubeMapMaskUV;
+ #endif
+ float _CubeMapUVMode;
+ float _CubeMapMaskInvert;
+ float4 _CubeMapColor;
+ float _CubeMapColorThemeIndex;
+ float _CubeMapIntensity;
+ float _CubeMapReplace;
+ float _CubeMapMultiply;
+ float _CubeMapAdd;
+ float _CubeMapEnable;
+ float _CubeMapLightMask;
+ float _CubeMapEmissionStrength;
+ float _CubeMapNormal;
+ float _CubeMapHueShiftEnabled;
+ float _CubeMapHueShiftSpeed;
+ float _CubeMapHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ float _Is_NormalMapToRimLight;
+ float4 _RimLightColor;
+ float _RimLightColorThemeIndex;
+ #ifdef _RIMSTYLE_POIYOMI
+ float _RimLightingInvert;
+ float _RimWidth;
+ float _RimStrength;
+ float _RimSharpness;
+ float _RimBaseColorMix;
+ float _ShadowMix;
+ float _ShadowMixThreshold;
+ float _ShadowMixWidthMod;
+ float _EnableRimLighting;
+ float _RimWidthNoiseStrength;
+ float4 _RimShadowAlpha;
+ float _RimShadowWidth;
+ float _RimBlendStrength;
+ float _RimBlendMode;
+ float _RimShadowToggle;
+ float _RimPower;
+ float _RimShadowMaskStrength;
+ float _RimShadowMaskRampType;
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimTex;
+ #endif
+ float4 _RimTex_ST;
+ float2 _RimTexPan;
+ float _RimTexUV;
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimMask;
+ #endif
+ float4 _RimMask_ST;
+ float2 _RimMaskPan;
+ float _RimMaskUV;
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimWidthNoiseTexture;
+ #endif
+ float4 _RimWidthNoiseTexture_ST;
+ float2 _RimWidthNoiseTexturePan;
+ float _RimWidthNoiseTextureUV;
+
+ #ifdef POI_AUDIOLINK
+ half _AudioLinkRimWidthBand;
+ float2 _AudioLinkRimWidthAdd;
+ half _AudioLinkRimEmissionBand;
+ float2 _AudioLinkRimEmissionAdd;
+ half _AudioLinkRimBrightnessBand;
+ float2 _AudioLinkRimBrightnessAdd;
+ #endif
+ #endif
+
+ #ifdef _RIMSTYLE_UTS2
+ float _RimLight;
+ float _Is_LightColor_RimLight;
+ 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;
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_RimLightMask;
+ float4 _Set_RimLightMask_ST;
+ float2 _Set_RimLightMaskPan;
+ float _Set_RimLightMaskUV;
+ #endif
+ float _Tweak_RimLightMaskLevel;
+ #endif
+
+ float _RimHueShiftEnabled;
+ float _RimHueShiftSpeed;
+ float _RimHueShift;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_SIMPLE
+ float _GlitterUV;
+ half3 _GlitterColor;
+ float _GlitterColorThemeIndex;
+ float2 _GlitterPan;
+ half _GlitterSpeed;
+ half _GlitterBrightness;
+ float _GlitterFrequency;
+ float _GlitterJitter;
+ half _GlitterSize;
+ half _GlitterContrast;
+ half _GlitterAngleRange;
+ half _GlitterMinBrightness;
+ half _GlitterBias;
+ fixed _GlitterUseSurfaceColor;
+ float _GlitterBlendType;
+ float _GlitterMode;
+ float _GlitterShape;
+ float _GlitterCenterSize;
+ float _glitterFrequencyLinearEmissive;
+ float _GlitterJaggyFix;
+ float _GlitterTextureRotation;
+ float2 _GlitterUVPanning;
+
+ float _GlitterHueShiftEnabled;
+ float _GlitterHueShiftSpeed;
+ float _GlitterHueShift;
+ float _GlitterHideInShadow;
+
+ float _GlitterRandomColors;
+ float2 _GlitterMinMaxSaturation;
+ float2 _GlitterMinMaxBrightness;
+ float _GlitterRandomSize;
+ float4 _GlitterMinMaxSize;
+ float _GlitterRandomRotation;
+
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterMask;
+ #endif
+ float4 _GlitterMask_ST;
+ float2 _GlitterMaskPan;
+ float _GlitterMaskUV;
+ #if defined(PROP_GLITTERCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterColorMap;
+ #endif
+ float4 _GlitterColorMap_ST;
+ float2 _GlitterColorMapPan;
+ float _GlitterColorMapUV;
+ #if defined(PROP_GLITTERTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _GlitterTexture;
+ #endif
+ float4 _GlitterTexture_ST;
+ float2 _GlitterTexturePan;
+ float _GlitterTextureUV;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float4 _MochieReflCube_HDR;
+ #ifdef MOCHIE_PBR
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MochieMetallicMaps;
+ #endif
+ float4 _MochieMetallicMaps_ST;
+ float2 _MochieMetallicMapsPan;
+ float _MochieMetallicMapsUV;
+ float _MochieMetallicMapInvert;
+ float _MochieRoughnessMapInvert;
+ float _MochieReflectionMaskInvert;
+ float _MochieSpecularMaskInvert;
+
+ float _MochieReflectionTintThemeIndex;
+ float _MochieSpecularTintThemeIndex;
+
+ float _MochieRoughnessMultiplier;
+ float _MochieMetallicMultiplier;
+ float _MochieReflectionStrength;
+ float _MochieSpecularStrength;
+ float4 _MochieSpecularTint;
+ float4 _MochieReflectionTint;
+ float _MochieLitFallback;
+ float _IgnoreCastedShadows;
+ float _PBRSplitMaskSample;
+ float4 _PBRMaskScaleTiling;
+ float _MochieMetallicMasksUV;
+ float4 _MochieMetallicMasksPan;
+
+ float _Specular2ndLayer;
+ float _MochieSpecularStrength2;
+ float _MochieRoughnessMultiplier2;
+ float _RefSpecFresnel;
+ samplerCUBE _MochieReflCube;
+ float _MochieForceFallback;
+ float _MochieGSAAEnabled;
+ float _PoiGSAAVariance;
+ float _PoiGSAAThreshold;
+ float _BRDFTPSReflectionMaskStrength;
+ float _BRDFTPSSpecularMaskStrength;
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _ClearCoatMaps;
+ float4 _ClearCoatMaps_ST;
+ float2 _ClearCoatMapsPan;
+ float _ClearCoatMapsUV;
+ #endif
+ float _ClearCoatBRDF;
+ float _ClearCoatReflectionStrength;
+ float _ClearCoatSpecularStrength;
+ float _ClearCoatStrength;
+ float _ClearCoatSmoothness;
+ float4 _ClearCoatReflectionTint;
+ float _ClearCoatReflectionTintThemeIndex;
+ float4 _ClearCoatSpecularTint;
+ float _ClearCoatSpecularTintThemeIndex;
+ float _ClearCoatSmoothnessMapInvert;
+ float _ClearCoatMaskInvert;
+ float _ClearCoatReflectionMaskInvert;
+ float _ClearCoatSpecularMaskInvert;
+ float _ClearCoatTPSMaskStrength;
+
+ samplerCUBE _ClearCoatFallback;
+ float _ClearCoatForceFallback;
+ float _ClearCoatLitFallback;
+ float _CCIgnoreCastedShadows;
+ float _ClearCoatGSAAEnabled;
+ float _ClearCoatGSAAVariance;
+ float _ClearCoatGSAAThreshold;
+ #endif
+
+ #ifdef POI_ENVIRORIM
+
+ #if defined(PROP_RIMENVIROMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _RimEnviroMask;
+ #endif
+ float4 _RimEnviroMask_ST;
+ float2 _RimEnviroMaskPan;
+ float _RimEnviroMaskUV;
+
+ float _RimEnviroBlur;
+ float _RimEnviroMinBrightness;
+ float _RimEnviroWidth;
+ float _RimEnviroSharpness;
+ float _RimEnviroIntensity;
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _HighColor_Tex;
+ #endif
+ float4 _HighColor_Tex_ST;
+ float2 _HighColor_TexPan;
+ float _HighColor_TexUV;
+
+ #if defined(PROP_SET_HIGHCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Set_HighColorMask;
+ #endif
+ float4 _Set_HighColorMask_ST;
+ float2 _Set_HighColorMaskPan;
+ float _Set_HighColorMaskUV;
+ float _Tweak_HighColorMaskLevel;
+
+ /*
+ #if defined(PROP_StylizedSpecularOPTMAP1) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap1;
+ #endif
+ float4 _StylizedSpecularOptMap1_ST;
+ float2 _StylizedSpecularOptMap1Pan;
+ float _StylizedSpecularOptMap1UV;
+
+ #if defined(PROP_StylizedSpecularOPTMAP2) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _StylizedSpecularOptMap2;
+ #endif
+ float4 _StylizedSpecularOptMap2_ST;
+ float2 _StylizedSpecularOptMap2Pan;
+ float _StylizedSpecularOptMap2UV;
+ */
+
+ float4 _HighColor;
+ float _UseLightColor;
+
+ float _HighColor_Power;
+ float _StylizedSpecularFeather;
+ float _Layer1Strength;
+
+ float _Layer2Size;
+ float _StylizedSpecular2Feather;
+ float _Layer2Strength;
+ float _SSIgnoreCastedShadows;
+ float _StylizedSpecularStrength;
+ float _UseSpecularOptMap2;
+ float _HighColorThemeIndex;
+ float _Is_BlendAddToHiColor;
+ float _Is_SpecularToHighColor;
+ #endif
+
+ #ifdef POI_PATHING
+
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingMap;
+ SamplerState SmpRepeatPoint;
+ #endif
+ float4 _PathingMap_ST;
+ float2 _PathingMapPan;
+ float _PathingMapUV;
+
+ #if defined(PROP_PATHINGCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PathingColorMap;
+ #endif
+ float4 _PathingColorMap_ST;
+ float2 _PathingColorMapPan;
+ float _PathingColorMapUV;
+ float _PathingOverrideAlpha;
+ // Fill, 0, Path, 1, Loop, 2
+ float _PathTypeR;
+ float _PathTypeG;
+ float _PathTypeB;
+ float _PathTypeA;
+ float _PathGradientType;
+ half4 _PathWidth;
+ float4 _PathTime;
+ float4 _PathOffset;
+ float4 _PathSpeed;
+ float4 _PathColorR;
+ float4 _PathColorG;
+ float4 _PathColorB;
+ float4 _PathColorA;
+ float4 _PathEmissionStrength;
+ float4 _PathSoftness;
+ float4 _PathSegments;
+
+ float _PathColorRThemeIndex;
+ float _PathColorGThemeIndex;
+ float _PathColorBThemeIndex;
+ float _PathColorAThemeIndex;
+
+ #ifdef POI_AUDIOLINK
+ float _PathALAutoCorrelator;
+ float _PathALAutoCorrelatorR;
+ float _PathALAutoCorrelatorG;
+ float _PathALAutoCorrelatorB;
+ float _PathALAutoCorrelatorA;
+
+ float _PathALHistory;
+ float _PathALHistoryBandR;
+ float _PathALHistoryR;
+ float _PathALHistoryBandG;
+ float _PathALHistoryG;
+ float _PathALHistoryBandB;
+ float _PathALHistoryB;
+ float _PathALHistoryBandA;
+ float _PathALHistoryA;
+
+ float _PathALCCR;
+ float _PathALCCG;
+ float _PathALCCB;
+ float _PathALCCA;
+
+ // Time Offset
+ float _PathALTimeOffset;
+ half _AudioLinkPathTimeOffsetBandR;
+ half2 _AudioLinkPathTimeOffsetR;
+ half _AudioLinkPathTimeOffsetBandG;
+ half2 _AudioLinkPathTimeOffsetG;
+ half _AudioLinkPathTimeOffsetBandB;
+ half2 _AudioLinkPathTimeOffsetB;
+ half _AudioLinkPathTimeOffsetBandA;
+ half2 _AudioLinkPathTimeOffsetA;
+
+ // Emission Offset
+ float _PathALEmissionOffset;
+ half _AudioLinkPathEmissionAddBandR;
+ half2 _AudioLinkPathEmissionAddR;
+ half _AudioLinkPathEmissionAddBandG;
+ half2 _AudioLinkPathEmissionAddG;
+ half _AudioLinkPathEmissionAddBandB;
+ half2 _AudioLinkPathEmissionAddB;
+ half _AudioLinkPathEmissionAddBandA;
+ half2 _AudioLinkPathEmissionAddA;
+
+ // Length Offset
+ float _PathALWidthOffset;
+ half _AudioLinkPathWidthOffsetBandR;
+ half2 _AudioLinkPathWidthOffsetR;
+ half _AudioLinkPathWidthOffsetBandG;
+ half2 _AudioLinkPathWidthOffsetG;
+ half _AudioLinkPathWidthOffsetBandB;
+ half2 _AudioLinkPathWidthOffsetB;
+ half _AudioLinkPathWidthOffsetBandA;
+ half2 _AudioLinkPathWidthOffsetA;
+
+ // Chrono Time
+ float _PathALChrono;
+ float _PathChronoBandR;
+ float _PathChronoTypeR;
+ float _PathChronoSpeedR;
+ float _PathChronoBandG;
+ float _PathChronoTypeG;
+ float _PathChronoSpeedG;
+ float _PathChronoBandB;
+ float _PathChronoTypeB;
+ float _PathChronoSpeedB;
+ float _PathChronoBandA;
+ float _PathChronoTypeA;
+ float _PathChronoSpeedA;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ #ifdef POI_IRIDESCENCE
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceRamp;
+ #endif
+ float4 _IridescenceRamp_ST;
+ float2 _IridescenceRampPan;
+
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceMask;
+ #endif
+ float4 _IridescenceMask_ST;
+ float2 _IridescenceMaskPan;
+ float _IridescenceMaskUV;
+
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _IridescenceNormalMap;
+ #endif
+ float4 _IridescenceNormalMap_ST;
+ float2 _IridescenceNormalMapPan;
+ float _IridescenceNormalMapUV;
+
+ float _IridescenceIntensity;
+ float _IridescenceHueShiftEnabled;
+ float _IridescenceHueShiftSpeed;
+ float _IridescenceHueShift;
+
+ float _IridescenceNormalSelection;
+ float _IridescenceNormalIntensity;
+ float _IridescenceNormalToggle;
+ float _IridescenceAddBlend;
+ float _IridescenceReplaceBlend;
+ float _IridescenceMultiplyBlend;
+ float _IridescenceEmissionStrength;
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkRimEmissionBand;
+ float2 _IridescenceAudioLinkEmissionAdd;
+ #endif
+ #endif
+
+ #ifdef EFFECT_BUMP
+ sampler2D _TextGlyphs;
+ float4 _TextGlyphs_ST;
+ float4 _TextGlyphs_TexelSize;
+ float _TextFPSUV;
+ float _TextTimeUV;
+ float _TextPositionUV;
+ float _TextPixelRange;
+
+ float _TextFPSEnabled;
+ float _TextPositionEnabled;
+ float _TextTimeEnabled;
+
+ float4 _TextFPSColor;
+ float _TextFPSEmissionStrength;
+ fixed4 _TextFPSPadding;
+ float2 _TextFPSOffset;
+ float2 _TextFPSScale;
+ float _TextFPSRotation;
+
+ fixed _TextPositionVertical;
+ float4 _TextPositionColor;
+ float _TextPositionEmissionStrength;
+ fixed4 _TextPositionPadding;
+ float2 _TextPositionOffset;
+ float2 _TextPositionScale;
+ float _TextPositionRotation;
+
+ float4 _TextTimeColor;
+ float _TextTimeEmissionStrength;
+ fixed4 _TextTimePadding;
+ float2 _TextTimeOffset;
+ float2 _TextTimeScale;
+ float _TextTimeRotation;
+
+ float _TextFPSColorThemeIndex;
+ float _TextPositionColorThemeIndex;
+ float _TextTimeColorThemeIndex;
+
+ float3 globalTextEmission;
+
+ #define ASCII_LEFT_PARENTHESIS 40
+ #define ASCII_RIGHT_PARENTHESIS 41
+ #define ASCII_POSITIVE 43
+ #define ASCII_PERIOD 46
+ #define ASCII_NEGATIVE 45
+ #define ASCII_COMMA 44
+ #define ASCII_E 69
+ #define ASCII_F 70
+ #define ASCII_I 73
+ #define ASCII_M 77
+ #define ASCII_O 79
+ #define ASCII_P 80
+ #define ASCII_S 83
+ #define ASCII_T 54
+ #define ASCII_SEMICOLON 58
+ #define glyphWidth 0.0625
+
+ #endif
+
+ float _FXProximityColor;
+ float _FXProximityColorType;
+ float3 _FXProximityColorMinColor;
+ float3 _FXProximityColorMaxColor;
+ float _FXProximityColorMinColorThemeIndex;
+ float _FXProximityColorMaxColorThemeIndex;
+ float _FXProximityColorMinDistance;
+ float _FXProximityColorMaxDistance;
+
+ #ifdef POSTPROCESS
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _PPMask;
+ #endif
+ float4 _PPMask_ST;
+ float2 _PPMaskPan;
+ float _PPMaskUV;
+ float _PPMaskInvert;
+
+ float3 _PPTint;
+ float3 _PPRGB;
+ float _PPHue;
+ float _PPContrast;
+ float _PPSaturation;
+ float _PPBrightness;
+ float _PPLightness;
+ float _PPHDR;
+ const static float COLORS = 32;
+
+ #endif
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ void calculateGlobalThemes(inout PoiMods poiMods)
+ {
+ poiMods.globalColorTheme[0] = _GlobalThemeColor0;
+ poiMods.globalColorTheme[1] = _GlobalThemeColor1;
+ poiMods.globalColorTheme[2] = _GlobalThemeColor2;
+ poiMods.globalColorTheme[3] = _GlobalThemeColor3;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ #ifdef FINALPASS
+ void ApplyDetailColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DETAILTEX) || !defined(OPTIMIZER_ENABLED)
+ half3 detailTexture = POI2D_SAMPLER_PAN(_DetailTex, _MainTex, poiUV(poiMesh.uv[_DetailTexUV], _DetailTex_ST), _DetailTexPan).rgb * poiThemeColor(poiMods, _DetailTint, _DetailTintThemeIndex);
+ #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)
+ poiMods.detailMask = POI2D_SAMPLER_PAN(_DetailMask, _MainTex, poiUV(poiMesh.uv[_DetailMaskUV], _DetailMask_ST), _DetailMaskPan).rg;
+ #else
+ poiMods.detailMask = 1;
+ #endif
+
+ #ifdef POI_BACKFACE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMods.detailMask.g *= _BackFaceDetailIntensity;
+ }
+ #endif
+
+ #if defined(PROP_DETAILNORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ half3 detailNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_DetailNormalMap, _MainTex, poiUV(poiMesh.uv[_DetailNormalMapUV], _DetailNormalMap_ST), _DetailNormalMapPan), _DetailNormalMapScale * poiMods.detailMask.g);
+ poiMesh.tangentSpaceNormal = BlendNormals(detailNormal, poiMesh.tangentSpaceNormal);
+ #endif
+ }
+ #endif
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef VIGNETTE
+ #if defined(GEOM_TYPE_MESH) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ void calculateRGBNormals(inout PoiMesh poiMesh)
+ {
+ float4 rgbMask;
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalsEnabled)
+ {
+ //UNITY_BRANCH
+ if (_RGBNormalBlend == 0)
+ {
+ //UNITY_BRANCH
+ if (_RgbNormalRScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.r);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalGScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.g);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalBScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.b);
+ }
+
+ //UNITY_BRANCH
+ if (_RgbNormalAScale > 0)
+ {
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale);
+ poiMesh.tangentSpaceNormal = lerp(poiMesh.tangentSpaceNormal, normalToBlendWith, rgbMask.a);
+ }
+ }
+ else
+ {
+ half3 newNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalR, _MainTex, poiUV(poiMesh.uv[_RgbNormalRUV], _RgbNormalR_ST), _RgbNormalRPan), _RgbNormalRScale * rgbMask.r);
+ half3 normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalG, _MainTex, poiUV(poiMesh.uv[_RgbNormalGUV], _RgbNormalG_ST), _RgbNormalGPan), _RgbNormalGScale * rgbMask.g);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalB, _MainTex, poiUV(poiMesh.uv[_RgbNormalBUV], _RgbNormalB_ST), _RgbNormalBPan), _RgbNormalBScale * rgbMask.b);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ normalToBlendWith = UnpackScaleNormal(POI2D_SAMPLER_PAN(_RgbNormalA, _MainTex, poiUV(poiMesh.uv[_RgbNormalAUV], _RgbNormalA_ST), _RgbNormalAPan), _RgbNormalAScale * rgbMask.a);
+ newNormal = BlendNormals(newNormal, normalToBlendWith);
+ poiMesh.tangentSpaceNormal = BlendNormals(newNormal, poiMesh.tangentSpaceNormal);
+ }
+ }
+ }
+ #endif
+ void calculateRGBMask(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ //If RGB normals are in use this data will already exist
+ float4 rgbMask = float4(1, 1, 1, 1);
+ //UNITY_BRANCH
+ if (_RGBUseVertexColors)
+ {
+ rgbMask = poiMesh.vertexColor;
+ }
+ else
+ {
+ #if defined(PROP_RGBMASK) || !defined(OPTIMIZER_ENABLED)
+ rgbMask = POI2D_SAMPLER_PAN(_RGBMask, _MainTex, poiUV(poiMesh.uv[_RGBMaskUV], _RGBMask_ST), _RGBMaskPan);
+ #else
+ rgbMask = 1;
+ #endif
+ }
+
+ #if defined(PROP_REDTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 red = POI2D_SAMPLER_PAN(_RedTexture, _MainTex, poiUV(poiMesh.uv[_RedTextureUV], _RedTexture_ST), _RedTexturePan);
+ #else
+ float4 red = 1;
+ #endif
+ #if defined(PROP_GREENTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 green = POI2D_SAMPLER_PAN(_GreenTexture, _MainTex, poiUV(poiMesh.uv[_GreenTextureUV], _GreenTexture_ST), _GreenTexturePan);
+ #else
+ float4 green = 1;
+ #endif
+ #if defined(PROP_BLUETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 blue = POI2D_SAMPLER_PAN(_BlueTexture, _MainTex, poiUV(poiMesh.uv[_BlueTextureUV], _BlueTexture_ST), _BlueTexturePan);
+ #else
+ float4 blue = 1;
+ #endif
+ #if defined(PROP_ALPHATEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 alpha = POI2D_SAMPLER_PAN(_AlphaTexture, _MainTex, poiUV(poiMesh.uv[_AlphaTextureUV], _AlphaTexture_ST), _AlphaTexturePan);
+ #else
+ float4 alpha = 1;
+ #endif
+
+ //UNITY_BRANCH
+ if (_RGBBlendMultiplicative)
+ {
+ float3 RGBColor = 1;
+ RGBColor = lerp(RGBColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ RGBColor = lerp(RGBColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ RGBColor = lerp(RGBColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ RGBColor = lerp(RGBColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+
+ poiFragData.baseColor *= RGBColor;
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, red.rgb * poiThemeColor(poiMods, _RedColor.rgb, _RedColorThemeIndex), rgbMask.r * red.a * _RedColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, green.rgb * poiThemeColor(poiMods, _GreenColor.rgb, _GreenColorThemeIndex), rgbMask.g * green.a * _GreenColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, blue.rgb * poiThemeColor(poiMods, _BlueColor.rgb, _BlueColorThemeIndex), rgbMask.b * blue.a * _BlueColor.a);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, alpha.rgb * poiThemeColor(poiMods, _AlphaColor.rgb, _AlphaColorThemeIndex), rgbMask.a * alpha.a * _AlphaColor.a);
+ }
+ }
+ #endif
+
+ #if defined(GEOM_TYPE_BRANCH) || defined(GEOM_TYPE_BRANCH_DETAIL) || defined(GEOM_TYPE_FROND) || defined(DEPTH_OF_FIELD_COC_VIEW)
+ float2 decalUV(float uvNumber, float4 uv_st, float2 position, half rotation, half rotationSpeed, half2 scale, float4 scaleOffset, float depth, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ scaleOffset = float4(-scaleOffset.x, scaleOffset.y, -scaleOffset.z, scaleOffset.w);
+ float2 uv = poiUV(poiMesh.uv[uvNumber], uv_st) + calcParallax(depth + 1, poiCam);
+ float2 decalCenter = position;
+ float theta = radians(rotation + _Time.z * rotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - scale / 2 + position + scaleOffset.xz, scale / 2 + position + scaleOffset.yw, float2(0, 0), float2(1, 1));
+ return uv;
+ }
+
+ inline float3 decalHueShift(float enabled, float3 color, float shift, float shiftSpeed)
+ {
+ //UNITY_BRANCH
+ if (enabled)
+ {
+ color = hueShift(color, shift + _Time.x * shiftSpeed);
+ }
+ return color;
+ }
+
+ inline float applyTilingClipping(float enabled, float2 uv)
+ {
+ float ret = 1;
+ //UNITY_BRANCH
+ if (!enabled)
+ {
+ if (uv.x > 1 || uv.y > 1 || uv.x < 0 || uv.y < 0)
+ {
+ ret = 0;
+ }
+ }
+ return ret;
+ }
+
+ void applyDecals(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods, in PoiLight poiLight)
+ {
+ float decalAlpha = 1;
+ float alphaOverride = 0;
+ #if defined(PROP_DECALMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 decalMask = POI2D_SAMPLER_PAN(_DecalMask, _MainTex, poiUV(poiMesh.uv[_DecalMaskUV], _DecalMask_ST), _DecalMaskPan);
+ #else
+ float4 decalMask = 1;
+ #endif
+
+ #ifdef TPS_Penetrator
+ if (_DecalTPSDepthMaskEnabled)
+ {
+ decalMask.r = lerp(0, decalMask.r * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal0TPSMaskStrength);
+ decalMask.g = lerp(0, decalMask.g * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal1TPSMaskStrength);
+ decalMask.b = lerp(0, decalMask.b * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal2TPSMaskStrength);
+ decalMask.a = lerp(0, decalMask.a * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _Decal3TPSMaskStrength);
+ }
+ #endif
+ float4 decalColor = 1;
+ float2 uv = 0;
+
+ // Decal 0
+ float2 decalScale = float2(1, 1);
+ float decalRotation = 0;
+ float2 ddxuv = 0;
+ float2 ddyuv = 0;
+ float4 sideMod = 0;
+ #ifdef GEOM_TYPE_BRANCH
+ decalScale = _DecalScale;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal0Scale.xy, _AudioLinkDecal0Scale.zw, poiMods.audioLink[_AudioLinkDecal0ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal0SideMin, _AudioLinkDecal0SideMax, poiMods.audioLink[_AudioLinkDecal0SideBand]);
+ decalRotation += lerp(_AudioLinkDecal0Rotation.x, _AudioLinkDecal0Rotation.y, poiMods.audioLink[_AudioLinkDecal0RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType0, _DecalRotationCTALBand0) * _DecalRotationCTALSpeed0 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture, uv + _DecalTexturePan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #else
+ uv = decalUV(_DecalTextureUV, _DecalTexture_ST, _DecalPosition, _DecalRotation + decalRotation, _DecalRotationSpeed, decalScale, _DecalSideOffset +sideMod, _Decal0Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor.rgb, _DecalColorThemeIndex), _DecalColor.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled, decalColor.rgb, _DecalHueShift + poiLight.nDotV * _Decal0HueAngleStrength, _DecalHueShiftSpeed);
+ decalColor.a *= applyTilingClipping(_DecalTiled, uv) * decalMask[_Decal0MaskChannel];
+
+ float audioLinkDecalAlpha0 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC0 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha0 = lerp(_AudioLinkDecal0Alpha.x, _AudioLinkDecal0Alpha.y, poiMods.audioLink[_AudioLinkDecal0AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType), decalColor.a * saturate(_DecalBlendAlpha + audioLinkDecalAlpha0));
+ if (_DecalOverrideAlpha)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal0MaskChannel]);
+ }
+ float audioLinkDecalEmission0 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission0 = lerp(_AudioLinkDecal0Emission.x, _AudioLinkDecal0Emission.y, poiMods.audioLink[_AudioLinkDecal0EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength + audioLinkDecalEmission0, 0);
+ #endif
+ #ifdef GEOM_TYPE_BRANCH_DETAIL
+ // Decal 1
+ decalScale = _DecalScale1;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal1Scale.xy, _AudioLinkDecal1Scale.zw, poiMods.audioLink[_AudioLinkDecal1ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal1SideMin, _AudioLinkDecal1SideMax, poiMods.audioLink[_AudioLinkDecal1SideBand]);
+ decalRotation += lerp(_AudioLinkDecal1Rotation.x, _AudioLinkDecal1Rotation.y, poiMods.audioLink[_AudioLinkDecal1RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType1, _DecalRotationCTALBand1) * _DecalRotationCTALSpeed1 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE1) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture1, uv + _DecalTexture1Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #else
+ uv = decalUV(_DecalTexture1UV, _DecalTexture1_ST, _DecalPosition1, _DecalRotation1 + decalRotation, _DecalRotationSpeed1, decalScale, _DecalSideOffset1 + sideMod, _Decal1Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor1.rgb, _DecalColor1ThemeIndex), _DecalColor1.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled1, decalColor.rgb, _DecalHueShift1 + poiLight.nDotV * _Decal1HueAngleStrength, _DecalHueShiftSpeed1);
+ decalColor.a *= applyTilingClipping(_DecalTiled1, uv) * decalMask[_Decal1MaskChannel];
+
+ float audioLinkDecalAlpha1 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC1 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha1 = lerp(_AudioLinkDecal1Alpha.x, _AudioLinkDecal1Alpha.y, poiMods.audioLink[_AudioLinkDecal1AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType1), decalColor.a * saturate(_DecalBlendAlpha1 + audioLinkDecalAlpha1));
+ if (_DecalOverrideAlpha1)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal1MaskChannel]);
+ }
+ float audioLinkDecalEmission1 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission1 = lerp(_AudioLinkDecal1Emission.x, _AudioLinkDecal1Emission.y, poiMods.audioLink[_AudioLinkDecal1EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength1 + audioLinkDecalEmission1, 0);
+ #endif
+ #ifdef GEOM_TYPE_FROND
+ // Decal 2
+ decalScale = _DecalScale2;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal2Scale.xy, _AudioLinkDecal2Scale.zw, poiMods.audioLink[_AudioLinkDecal2ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal2SideMin, _AudioLinkDecal2SideMax, poiMods.audioLink[_AudioLinkDecal2SideBand]);
+ decalRotation += lerp(_AudioLinkDecal2Rotation.x, _AudioLinkDecal2Rotation.y, poiMods.audioLink[_AudioLinkDecal2RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType2, _DecalRotationCTALBand2) * _DecalRotationCTALSpeed2 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE2) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture2, uv + _DecalTexture2Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #else
+ uv = decalUV(_DecalTexture2UV, _DecalTexture2_ST, _DecalPosition2, _DecalRotation2 + decalRotation, _DecalRotationSpeed2, decalScale, _DecalSideOffset2 + sideMod, _Decal2Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor2.rgb, _DecalColor2ThemeIndex), _DecalColor2.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled2, decalColor.rgb, _DecalHueShift2 + poiLight.nDotV * _Decal2HueAngleStrength, _DecalHueShiftSpeed2);
+ decalColor.a *= applyTilingClipping(_DecalTiled2, uv) * decalMask[_Decal2MaskChannel];
+
+ float audioLinkDecalAlpha2 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC2 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha2 = lerp(_AudioLinkDecal2Alpha.x, _AudioLinkDecal2Alpha.y, poiMods.audioLink[_AudioLinkDecal2AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType2), decalColor.a * saturate(_DecalBlendAlpha2 + audioLinkDecalAlpha2));
+ if (_DecalOverrideAlpha2)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal2MaskChannel]);
+ }
+ float audioLinkDecalEmission2 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission2 = lerp(_AudioLinkDecal2Emission.x, _AudioLinkDecal2Emission.y, poiMods.audioLink[_AudioLinkDecal2EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength2 + audioLinkDecalEmission2, 0);
+ #endif
+ #ifdef DEPTH_OF_FIELD_COC_VIEW
+ // Decal 3
+ decalScale = _DecalScale3;
+ decalRotation = 0;
+ sideMod = 0;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ decalScale += lerp(_AudioLinkDecal3Scale.xy, _AudioLinkDecal3Scale.zw, poiMods.audioLink[_AudioLinkDecal3ScaleBand]);
+ sideMod += lerp(_AudioLinkDecal3SideMin, _AudioLinkDecal3SideMax, poiMods.audioLink[_AudioLinkDecal3SideBand]);
+ decalRotation += lerp(_AudioLinkDecal3Rotation.x, _AudioLinkDecal3Rotation.y, poiMods.audioLink[_AudioLinkDecal3RotationBand]);
+ decalRotation += AudioLinkGetChronoTime(_DecalRotationCTALType3, _DecalRotationCTALBand3) * _DecalRotationCTALSpeed3 * 360;
+ }
+ #endif
+ #if defined(PROP_DECALTEXTURE3) || !defined(OPTIMIZER_ENABLED)
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ ddxuv = ddx(uv);
+ ddyuv = ddy(uv);
+ if (any(fwidth(uv) > .5))
+ {
+ ddxuv = ddyuv = 0.001;
+ }
+ decalColor = tex2D(_DecalTexture3, uv + _DecalTexture3Pan * _Time.x, ddxuv, ddyuv) * float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #else
+ uv = decalUV(_DecalTexture3UV, _DecalTexture3_ST, _DecalPosition3, _DecalRotation3 + decalRotation, _DecalRotationSpeed3, decalScale, _DecalSideOffset3 + sideMod, _Decal3Depth, poiMesh, poiCam);
+ decalColor = float4(poiThemeColor(poiMods, _DecalColor3.rgb, _DecalColor3ThemeIndex), _DecalColor3.a);
+ #endif
+ decalColor.rgb = decalHueShift(_DecalHueShiftEnabled3, decalColor.rgb, _DecalHueShift3 + poiLight.nDotV * _Decal3HueAngleStrength, _DecalHueShiftSpeed3);
+ decalColor.a *= applyTilingClipping(_DecalTiled3, uv) * decalMask[_Decal3MaskChannel];
+
+ float audioLinkDecalAlpha3 = 0;
+ #ifdef POI_AUDIOLINK
+ if (_AudioLinkDecalCC3 && poiMods.audioLinkAvailable)
+ {
+ decalColor.rgb *= AudioLinkLerp(ALPASS_CCSTRIP + float2(uv.x * AUDIOLINK_WIDTH, 0)).rgb;
+ }
+ audioLinkDecalAlpha3 = lerp(_AudioLinkDecal3Alpha.x, _AudioLinkDecal3Alpha.y, poiMods.audioLink[_AudioLinkDecal3AlphaBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, customBlend(poiFragData.baseColor.rgb, decalColor.rgb, _DecalBlendType3), decalColor.a * saturate(_DecalBlendAlpha3 + audioLinkDecalAlpha3));
+ if (_DecalOverrideAlpha3)
+ {
+ alphaOverride += 1;
+ decalAlpha = lerp(decalAlpha, min(decalAlpha, decalColor.a), decalMask[_Decal3MaskChannel]);
+ }
+ float audioLinkDecalEmission3 = 0;
+ #ifdef POI_AUDIOLINK
+ audioLinkDecalEmission3 = lerp(_AudioLinkDecal3Emission.x, _AudioLinkDecal3Emission.y, poiMods.audioLink[_AudioLinkDecal3EmissionBand]) * poiMods.audioLinkAvailable;
+ #endif
+
+ poiFragData.emission += decalColor.rgb * decalColor.a * max(_DecalEmissionStrength3 + audioLinkDecalEmission3, 0);
+ #endif
+ if (alphaOverride)
+ {
+ poiFragData.alpha *= decalAlpha;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ #ifdef VIGNETTE_MASKED
+
+ //CLOTH
+ #ifdef _LIGHTINGMODE_CLOTH
+ #define HARD 0
+ #define LERP 1
+ #ifdef POI_CLOTHLERP
+ #define CLOTHMODE LERP
+ #else
+ #define CLOTHMODE HARD
+ #endif
+ float V_SmithGGXCorrelated(float roughness, float NoV, float NoL)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float a2 = roughness * roughness;
+ // TODO: lambdaV can be pre-computed for all the lights, it should be moved out of this function
+ float lambdaV = NoL * sqrt((NoV - a2 * NoV) * NoV + a2);
+ float lambdaL = NoV * sqrt((NoL - a2 * NoL) * NoL + a2);
+ float v = 0.5 / (lambdaV + lambdaL);
+ // a2=0 => v = 1 / 4*NoL*NoV => min=1/4, max=+inf
+ // a2=1 => v = 1 / 2*(NoL+NoV) => min=1/4, max=+inf
+ // 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
+ // This computes 1.0 - NoH^2 directly (which is close to zero in the highlights and has
+ // 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)
+ {
+ // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
+ float invAlpha = 1.0 / roughness;
+ float cos2h = NoH * NoH;
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(GGXTerm(roughness, NoH), D_Charlie(roughness, NoH), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? GGXTerm(roughness, NoH) : D_Charlie(roughness, NoH);
+ #endif
+ }
+
+ float Visibility(float roughness, float NoV, float NoL, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(V_SmithGGXCorrelated(roughness, NoV, NoL), V_Neubelt(NoV, NoL), cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? V_SmithGGXCorrelated(roughness, NoV, NoL) : V_Neubelt(NoV, NoL);
+ #endif
+ }
+
+ 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"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ 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)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(lerp(dfg.xxx, dfg.yyy, f0), f0 * dfg.z, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? lerp(dfg.xxx, dfg.yyy, f0) : f0 * dfg.z;
+ #endif
+ }
+
+ float3 EnvBRDFEnergyCompensation(float3 dfg, float3 f0, float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return lerp(1.0 + f0 * (1.0 / dfg.y - 1.0), 1, cloth);
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1.0 + f0 * (1.0 / dfg.y - 1.0) : 1;
+ #endif
+ }
+
+ //
+ float ClothMetallic(float cloth)
+ {
+ #if CLOTHMODE == LERP
+ return cloth;
+ #elif CLOTHMODE == HARD
+ return cloth <= 0.5 ? 1 : 0;
+ #endif
+ }
+
+ 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
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ 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)
+ {
+ envData.reflUVW = getBoxProjection(reflDir, poiMesh.worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin.xyz, unity_SpecCube1_BoxMax.xyz);
+ float3 probe1 = Unity_GlossyEnvironment(UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1, unity_SpecCube0), unity_SpecCube1_HDR, envData);
+ 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;
+ };
+
+ #undef LERP
+ #undef HARD
+ #undef CLOTHMODE
+ #endif
+ // CLOTH END
+ float _LightingWrappedWrap;
+ float _LightingWrappedNormalization;
+ // Green’s model with adjustable energy
+ // http://blog.stevemcauley.com/2011/12/03/energy-conserving-wrapped-diffuse/
+ // Modified for adjustable conservation ratio and over-wrap to directionless
+ 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)
+ {
+ o = lerp(o, flt, w - 1.0);
+ }
+ 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;
+ return r;
+ }
+ float3 ShadeSH9_wrapped(float3 normal, float wrap)
+ {
+ 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.
+ // Because getting it from L2 would be too hard!
+ return Unity_SafeNormalize((unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz));
+ }
+ // Returns the value from SH in the lighting direction with the
+ // brightest intensity.
+ half3 GetSHMaxL1()
+ {
+ float3 maxDirection = GetSHDirectionL1();
+ return ShadeSH9_wrapped(maxDirection, 0);
+ }
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ void applyShadeMapping(inout PoiFragData poiFragData, PoiMesh poiMesh, inout PoiLight poiLight)
+ {
+ 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)
+ {
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ else
+ {
+ poiFragData.baseColor.rgb *= lerp(1, lerp(firstShadeMap.rgb, secondShadeMap.rgb, firstSecondShadowMask), mainShadowMask);
+ }
+ poiLight.rampedLightMap = 1 - mainShadowMask;
+ }
+ #endif
+ void ApplySubtractiveLighting(inout UnityIndirect indirectLight)
+ {
+ #if SUBTRACTIVE_LIGHTING
+ poiLight.attenuation = FadeShadows(lerp(1, poiLight.attenuation, _AttenuationMultiplier));
+
+ float ndotl = saturate(dot(i.normal, _WorldSpaceLightPos0.xyz));
+ float3 shadowedLightEstimate = ndotl * (1 - poiLight.attenuation) * _LightColor0.rgb;
+ float3 subtractedLight = indirectLight.diffuse - shadowedLightEstimate;
+ subtractedLight = max(subtractedLight, unity_ShadowColor.rgb);
+ subtractedLight = lerp(subtractedLight, indirectLight.diffuse, _LightShadowData.x);
+ 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]
+ );
+ #endif
+ ApplySubtractiveLighting(indirectLight);
+ #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]
+ );
+ #else
+ indirectLight.diffuse += dynamicLightDiffuse;
+ #endif
+ #endif
+
+ #if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
+ #if UNITY_LIGHT_PROBE_PROXY_VOLUME
+ if (unity_ProbeVolumeParams.x == 1)
+ {
+ indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
+ float4(poiMesh.normals[1], 1), poiMesh.worldPos
+ );
+ indirectLight.diffuse = max(0, indirectLight.diffuse);
+ #if defined(UNITY_COLORSPACE_GAMMA)
+ indirectLight.diffuse = LinearToGammaSpace(indirectLight.diffuse);
+ #endif
+ }
+ else
+ {
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ }
+ #else
+ indirectLight.diffuse += max(0, ShadeSH9(float4(poiMesh.normals[1], 1)));
+ #endif
+ #endif
+
+ indirectLight.diffuse *= poiLight.occlusion;
+
+ return indirectLight;
+ }
+
+ void calculateShading(inout PoiLight poiLight, inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam)
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ float shadowStrength = _ShadowStrength * poiLight.shadowMask;
+
+ #ifdef POI_PASS_OUTLINE
+ shadowStrength = lerp(0, shadowStrength, _OutlineShadowStrength);
+ #endif
+
+ #ifdef _LIGHTINGMODE_FLAT
+ poiLight.finalLighting = poiLight.directColor;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ #endif
+
+ #ifdef _LIGHTINGMODE_TEXTURERAMP
+ poiLight.rampedLightMap = lerp(1, UNITY_SAMPLE_TEX2D(_ToonRamp, poiLight.lightMap + _ShadowOffset).rgb, shadowStrength);
+ poiLight.finalLighting = lerp(_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.rampedLightMap * poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion, poiLight.directColor, poiLight.rampedLightMap);
+ #endif
+
+ #ifdef _LIGHTINGMODE_MULTILAYER_MATH
+
+ float4 lns = float4(1, 1, 1, 1);
+ lns.x = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur);
+ lns.y = lilTooningNoSaturate(poiLight.lightMap, _Shadow2ndBorder, _Shadow2ndBlur);
+ lns.z = lilTooningNoSaturate(poiLight.lightMap, _Shadow3rdBorder, _Shadow3rdBlur);
+ lns.w = lilTooningNoSaturate(poiLight.lightMap, _ShadowBorder, _ShadowBlur, _ShadowBorderRange);
+ lns = saturate(lns);
+ float3 indirectColor = 1;
+
+ if (_ShadowColor.a > 0)
+ {
+ #if defined(PROP_SHADOWCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadowColorTex = POI2D_SAMPLER_PAN(_ShadowColorTex, _MainTex, poiUV(poiMesh.uv[_ShadowColorTexUV], _ShadowColorTex_ST), _ShadowColorTexPan);
+ #else
+ float4 shadowColorTex = float4(1, 1, 1, 1);
+ #endif
+ indirectColor = lerp(float3(1, 1, 1), shadowColorTex.rgb, shadowColorTex.a) * _ShadowColor.rgb;
+ }
+ if (_Shadow2ndColor.a > 0)
+ {
+ #if defined(PROP_SHADOW2NDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow2ndColorTex = POI2D_SAMPLER_PAN(_Shadow2ndColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow2ndColorTexUV], _Shadow2ndColorTex_ST), _Shadow2ndColorTexPan);
+ #else
+ float4 shadow2ndColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow2ndColorTex.rgb = lerp(float3(1, 1, 1), shadow2ndColorTex.rgb, shadow2ndColorTex.a) * _Shadow2ndColor.rgb;
+ lns.y = _Shadow2ndColor.a - lns.y * _Shadow2ndColor.a;
+ indirectColor = lerp(indirectColor, shadow2ndColorTex.rgb, lns.y);
+ }
+ if (_Shadow3rdColor.a > 0)
+ {
+ #if defined(PROP_SHADOW3RDCOLORTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 shadow3rdColorTex = POI2D_SAMPLER_PAN(_Shadow3rdColorTex, _MainTex, poiUV(poiMesh.uv[_Shadow3rdColorTexUV], _Shadow3rdColorTex_ST), _Shadow3rdColorTexPan);
+ #else
+ float4 shadow3rdColorTex = float4(1, 1, 1, 1);
+ #endif
+ shadow3rdColorTex.rgb = lerp(float3(1, 1, 1), shadow3rdColorTex.rgb, shadow3rdColorTex.a) * _Shadow3rdColor.rgb;
+ lns.z = _Shadow3rdColor.a - lns.z * _Shadow3rdColor.a;
+ indirectColor = lerp(indirectColor, shadow3rdColorTex.rgb, lns.z);
+ }
+
+ poiLight.rampedLightMap = lns.x;
+ indirectColor = lerp(indirectColor, 1, lns.w * _ShadowBorderColor.rgb);
+ indirectColor = indirectColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor);
+ indirectColor = lerp(poiLight.directColor, indirectColor, _ShadowStrength * poiLight.shadowMask);
+ poiLight.finalLighting = lerp(indirectColor, poiLight.directColor, lns.x);
+ // Old Way
+ //poiLight.rampedLightMap = saturate((poiLight.lightMap - (1 - _LightingGradientEnd)) / saturate((1 - _LightingGradientStart) - (1 - _LightingGradientEnd) + fwidth(poiLight.lightMap)));
+ //poiLight.finalLighting = lerp((_LightingShadowColor * lerp(poiLight.indirectColor, poiLight.directColor, _LightingIgnoreAmbientColor) * poiLight.occlusion), (poiLight.directColor), saturate(poiLight.rampedLightMap + 1 - shadowStrength));
+ #endif
+
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ poiLight.finalLighting = poiLight.directColor;
+ #endif
+
+ #ifdef _LIGHTINGMODE_REALISTIC
+ UnityLight light;
+ light.dir = poiLight.direction;
+ light.color = saturate(_LightColor0.rgb * lerp(1, poiLight.attenuation, poiLight.attenuationStrength) * poiLight.detailShadow);
+ light.ndotl = poiLight.nDotLSaturated;
+ poiLight.rampedLightMap = poiLight.nDotLSaturated;
+ poiLight.finalLighting = max(UNITY_BRDF_PBS(1, 0, 0, 0, poiMesh.normals[1], poiCam.viewDir, light, CreateIndirectLight(poiMesh, poiCam, poiLight)).xyz, _LightingMinLightBrightness);
+ #endif
+
+ #ifdef _LIGHTINGMODE_CLOTH
+
+ #if defined(PROP_MOCHIEMETALLICMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 clothmapsample = POI2D_MAINTEX_SAMPLER_PAN_INLINED(_ClothMetallicSmoothnessMap, poiMesh);
+ float roughness = 1 - (clothmapsample.a * _ClothSmoothness);
+ float reflectance = _ClothReflectance * clothmapsample.b;
+ float clothmask = clothmapsample.g;
+ float metallic = pow(clothmapsample.r * _ClothMetallic, 2) * ClothMetallic(clothmask);
+ roughness = _ClothMetallicSmoothnessMapInvert == 1 ? 1 - roughness : roughness;
+ #else
+ float roughness = 1 - (_ClothSmoothness);
+ float metallic = pow(_ClothMetallic, 2);
+ 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 * poiLight.attenuation * poiLight.nDotLSaturated;
+ float3 specular = max(0, Specular(clampedRoughness, poiLight, f0, poiMesh.normals[1], clothmask) * poiLight.finalLighting * energyCompensation * UNITY_PI); // (D * V) * F
+
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
+ float3 indirectDiffuse;
+ indirectDiffuse.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, poiMesh.normals[1]);
+ 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);
+
+ 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;
+
+ 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)) * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ float3 indirectColor = ShadeSH9_wrapped(poiMesh.normals[_LightingIndirectUsesNormals], _LightingWrappedWrap) * poiLight.occlusion;
+
+ 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) * poiLight.detailShadow;
+ 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);
+
+ float3 finalWrap = directColor + indirectColor;
+ if (_LightingCapEnabled)
+ {
+ finalWrap = clamp(finalWrap, _LightingMinLightBrightness, _LightingCap);
+ }
+ else
+ {
+ finalWrap = max(finalWrap, _LightingMinLightBrightness);
+ }
+ 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.
+ float subsurface = 1;
+ 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
+ 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 * poiLight.attenuation * tex2Dlod(_SkinLUT, sssLookupUv).rgb;
+ poiLight.finalLighting = min(lerp(poiLight.indirectColor * _LightingShadowColor, _LightingShadowColor, _LightingIgnoreAmbientColor) + (sss * poiLight.directColor), poiLight.directColor);
+ #endif
+
+ #ifdef _LIGHTINGMODE_SDF
+ /*
+ #if defined(PROP_SDFSHADINGTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float2 shadowSDF = POI2D_SAMPLER_PAN(_SDFShadingTexture, _MainTex, poiUV(poiMesh.uv[_SDFShadingTextureUV], _SDFShadingTexture_ST), _SDFShadingTexturePan).rg;
+ #else
+ float2 shadowSDF = float2(1,1);
+ #endif
+
+ float2 right = normalize(UnityObjectToWorldDir(float4(1, 0, 0, 1)).xz);
+ float2 forward = normalize(UnityObjectToWorldDir(float4(0, 0, 1, 1)).xz);
+ float dotF = dot(forward, poiLight.direction.xz);
+ float dotR = dot(right, poiLight.direction.xz);
+
+ float dotFStep = step(0, dotF);
+ float dotRAcos = (acos(dotR) / PI) * 2;
+ float dotRAcosDir = (dotR < 0) ? 1 - dotRAcos : dotRAcos - 1;
+ float texShadowDir = (dotR < 0) ? shadowSDF.g : shadowSDF.r;
+
+ float shadowDir = step(dotRAcosDir, texShadowDir) * dotFStep;
+ //float2 NormalXZ = normalize(poiMesh.normals[1].xz);
+
+ poiLight.finalLighting = 1;
+ poiFragData.baseColor = dotRAcos;
+ */
+ #endif
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDADD
+ // Realistic
+ if (_LightingAdditiveType == 0)
+ {
+ poiLight.rampedLightMap = max(0, poiLight.nDotL);
+ poiLight.finalLighting = poiLight.directColor * poiLight.attenuation * max(0, poiLight.nDotL) * poiLight.detailShadow * poiLight.additiveShadow;
+ }
+ // Toon
+ if (_LightingAdditiveType == 1)
+ {
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ float passthrough = 0;
+ #else
+ float passthrough = _LightingAdditivePassthrough;
+ #endif
+
+ if (_LightingAdditiveGradientEnd == _LightingAdditiveGradientStart) _LightingAdditiveGradientEnd += 0.001;
+
+ poiLight.rampedLightMap = smoothstep(_LightingAdditiveGradientEnd, _LightingAdditiveGradientStart, 1 - (.5 * poiLight.nDotL + .5));
+ #if defined(POINT) || defined(SPOT)
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.attenuation * poiLight.detailShadow;
+ #else
+ poiLight.finalLighting = lerp(poiLight.directColor * max(poiLight.attenuation, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ #endif
+ }
+ // Wrapped
+ if (_LightingAdditiveType == 2)
+ {
+ /*
+ float uv = saturate(RTWrapFunc(poiLight.nDotL, _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(poiLight.directColor * max(poiLight.additiveShadow, passthrough), poiLight.indirectColor, smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, 1 - (.5 * poiLight.nDotL + .5))) * poiLight.detailShadow;
+ float shadowatten = max(poiLight.additiveShadow, _LightingAdditivePassthrough);
+ poiLight.finalLighting = poiLight.directColor * poiLight.rampedLightMap * saturate(poiLight.attenuation * uv * shadowatten);
+ */
+ }
+ #endif
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float3 vertexLighting = float3(0, 0, 0);
+ for (int index = 0; index < 4; index++)
+ {
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 0)
+ {
+ vertexLighting += poiLight.vColor[index] * poiLight.vAttenuationDotNL[index] * poiLight.detailShadow; // Realistic
+
+ }
+
+ //UNITY_BRANCH
+ if (_LightingAdditiveType == 1) // Toon
+
+ {
+ vertexLighting += lerp(poiLight.vColor[index] * poiLight.vAttenuation[index], poiLight.vColor[index] * _LightingAdditivePassthrough * poiLight.vAttenuation[index], smoothstep(_LightingAdditiveGradientStart, _LightingAdditiveGradientEnd, .5 * poiLight.vDotNL[index] + .5)) * poiLight.detailShadow;
+ }
+
+ //UNITY_BRANCH
+ /*
+ if (_LightingAdditiveType == 2) //if(_LightingAdditiveType == 2) // Wrapped
+
+ {
+ float uv = saturate(RTWrapFunc(-poiLight.vDotNL[index], _LightingWrappedWrap, _LightingWrappedNormalization)) * poiLight.detailShadow;
+ poiLight.rampedLightMap = lerp(_LightingShadowColor, float3(1, 1, 1), saturate(1 - smoothstep(_LightingGradientStart - .000001, _LightingGradientEnd, 1 - uv)));
+ vertexLighting += poiLight.vColor[index] * poiLight.rampedLightMap * saturate(poiLight.vAttenuation[index] * uv);
+ }
+ */
+ }
+ float3 mixedLight = poiLight.finalLighting;
+ poiLight.finalLighting = vertexLighting + poiLight.finalLighting;
+ #endif
+ }
+ #endif
+
+ #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
+ float a2 = at * ab;
+ float3 d = float3(ab * TdotH, at * BdotH, a2 * NdotH);
+ float d2 = dot(d, d);
+ 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)
+ {
+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
+ float lambdaV = NdotL * length(float3(at * TdotV, ab * BdotV, NdotV));
+ float lambdaL = NdotV * length(float3(at * TdotL, ab * BdotL, NdotL));
+ 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);
+ float3 H = normalize(LightDirection + viewDir);
+ float dotTH = dot(ShiftedTangent, H);
+ float sinTH = sqrt(1.0 - dotTH * dotTH);
+ 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)));
+ }
+
+ float3 applyAnisotropics(inout PoiFragData poiFragData, inout PoiLight poiLight, in PoiCam poiCam, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_ANISOCOLORMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 specMap = POI2D_SAMPLER_PAN(_AnisoColorMap, _MainTex, poiUV(poiMesh.uv[_AnisoColorMapUV], _AnisoColorMap_ST), _AnisoColorMapPan);
+ #else
+ float4 specMap = float4(1, 1, 1, 0);
+ #endif
+
+ float3 binormalObj = normalize(mul(unity_WorldToObject, poiMesh.binormal));
+ float shadowMask = lerp(1, poiMax(poiLight.rampedLightMap), _AnisoHideInShadow);
+ #ifdef POI_PASS_ADD
+ shadowMask *= poiLight.attenuation;
+ #endif
+
+ float spec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.direction, _Aniso0Power * 1000, _Aniso0Strength, shadowMask);
+ float spec1 = calculateAnisotropics(binormalObj, _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 * _Aniso0Tint;
+ float3 spec1Color = specMap.rgb * _Aniso1Tint;
+
+ 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 defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ float vSpec0 = calculateAnisotropics(binormalObj, _Aniso0Offset +_Aniso0OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso0Power * 1000, _Aniso0Strength, poiLight.vAttenuationDotNL[index]);
+ float vSpec1 = calculateAnisotropics(binormalObj, _Aniso1Offset +_Aniso1OffsetMapStrength * specMap.a, poiMesh.normals[1], poiCam.viewDir, poiLight.vDirection[index], _Aniso1Power * 1000, _Aniso1Strength, poiLight.vAttenuationDotNL[index]);
+
+ vSpec0 = lerp(vSpec0, aaEdgeFeather(vSpec0, _Aniso0Edge, _Aniso0Blur), _Aniso0ToonMode);
+ vSpec1 = lerp(vSpec1, aaEdgeFeather(vSpec1, _Aniso1Edge, _Aniso1Blur), _Aniso1ToonMode);
+
+ float3 vSpec0Color = specMap.rgb * _Aniso0Tint;
+ float3 vSpec1Color = specMap.rgb * _Aniso1Tint;
+
+ poiLight.finalLightAdd += max(0, saturate(saturate(vSpec0 * spec0Color) + saturate(vSpec1 * spec1Color)) * 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, spec1Color * 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, spec0Color * lerp(1, baseColor, _AnisoUseBaseColor) * lerp(dot(poiLight.vColor[index], float3(0.299, 0.587, 0.114)), poiLight.vColor[index], _AnisoUseLightColor), _AnisoReplace * vSpec0);
+ }
+ #endif
+
+ #ifdef POI_ANISOTROPICS_DEBUG
+ switch(_AnisoDebugMode)
+ {
+ // final Spec
+ case 1:
+ {
+ return finalSpec;
+ break;
+ }
+ case 2:
+ {
+ return spec0 * spec0Color;
+ break;
+ }
+ case 3:
+ {
+ return spec1 * spec1Color;
+ break;
+ }
+ }
+ #endif
+
+ return float3(0, 0, 0);
+ }
+ #endif
+
+ void blendMatcap(inout PoiLight poiLight, inout PoiFragData poiFragData, float add, float lightAdd, float multiply, float replace, float mixed, float4 matcapColor, float matcapMask, float emissionStrength, float matcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , uint blackLightMaskIndex
+ #endif
+ )
+ {
+ if (matcapLightMask)
+ {
+ matcapMask *= lerp(1, poiLight.rampedLightMap, matcapLightMask);
+ }
+ #ifdef POI_BLACKLIGHT
+ if (blackLightMaskIndex != 4)
+ {
+ matcapMask *= blackLightMask[blackLightMaskIndex];
+ }
+ #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;
+ poiLight.finalLightAdd += matcapColor.rgb * lightAdd * matcapMask * matcapColor.a;
+ 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;
+ }
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ void applyMatcap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, inout PoiLight poiLight, in PoiMods poiMods)
+ {
+ float4 matcap = 0;
+ float matcapMask = 0;
+ float4 matcap2 = 0;
+ float matcap2Mask = 0;
+ float2 matcapUV = 0;
+
+ // Matcap 1
+ #ifdef POI_MATCAP0
+ float3 normal0 = poiMesh.normals[_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
+
+ switch(_MatcapUVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal0, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _MatcapBorder + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal0), dot(worldViewUp, normal0)) * _MatcapBorder + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal0);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _MatcapBorder + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP) || !defined(OPTIMIZER_ENABLED)
+ matcap = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap)) * float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #else
+ matcap = float4(poiThemeColor(poiMods, _MatcapColor.rgb, _MatcapColorThemeIndex), _MatcapColor.a);
+ #endif
+
+ matcap.rgb *= _MatcapIntensity;
+ #if defined(PROP_MATCAPMASK) || !defined(OPTIMIZER_ENABLED)
+ matcapMask = POI2D_SAMPLER_PAN(_MatcapMask, _MainTex, poiUV(poiMesh.uv[_MatcapMaskUV], _MatcapMask_ST), _MatcapMaskPan);
+ #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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _MatcapAdd, _MatcapAddToLight, _MatcapMultiply, _MatcapReplace, _MatcapMixed, matcap, matcapMask, _MatcapEmissionStrength, _MatcapLightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap
+ #endif
+ );
+ #endif
+
+ // Matcap 2
+ #ifdef COLOR_GRADING_HDR_3D
+
+ float3 normal1 = poiMesh.normals[_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
+
+ matcapUV = 0;
+
+ switch(_Matcap2UVMode)
+ {
+ // Normal / UTS
+ case 0:
+ {
+ float3 viewNormal = (mul(UNITY_MATRIX_V, float4(normal1, 0))).rgb;
+ float3 NormalBlend_MatCapUV_Detail = viewNormal.rgb * float3(-1, -1, 1);
+ float3 NormalBlend_MatCapUV_Base = (mul(UNITY_MATRIX_V, float4(poiCam.viewDir, 0)).rgb * float3(-1, -1, 1)) + float3(0, 0, 1);
+ float3 noSknewViewNormal = NormalBlend_MatCapUV_Base * dot(NormalBlend_MatCapUV_Base, NormalBlend_MatCapUV_Detail) / NormalBlend_MatCapUV_Base.b - NormalBlend_MatCapUV_Detail;
+
+ matcapUV = noSknewViewNormal.rg * _Matcap2Border + 0.5;
+ break;
+ }
+ // Top Pinch
+ case 1:
+ {
+ float3 worldViewUp = normalize(float3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, float3(0, 1, 0)));
+ float3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ matcapUV = float2(dot(worldViewRight, normal1), dot(worldViewUp, normal1)) * _Matcap2Border + 0.5;
+ break;
+ }
+ // Custom Double Sided
+ case 2:
+ {
+ float3 reflection = reflect(-poiCam.viewDir, normal1);
+ float2 uv = float2(dot(reflection, float3(1, 0, 0)), dot(reflection, float3(0, 1, 0)));
+ matcapUV = uv * _Matcap2Border + 0.5;
+ break;
+ }
+ }
+ if (IsInMirror())
+ {
+ matcapUV.x = 1 - matcapUV.x;
+ }
+
+ #if defined(PROP_MATCAP2) || !defined(OPTIMIZER_ENABLED)
+ matcap2 = UNITY_SAMPLE_TEX2D_SAMPLER(_Matcap2, _MainTex, TRANSFORM_TEX(matcapUV, _Matcap2)) * float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #else
+ matcap2 = float4(poiThemeColor(poiMods, _Matcap2Color.rgb, _Matcap2ColorThemeIndex), _Matcap2Color.a);
+ #endif
+ matcap2.rgb *= _Matcap2Intensity;
+ #if defined(PROP_MATCAP2MASK) || !defined(OPTIMIZER_ENABLED)
+ matcap2Mask = POI2D_SAMPLER_PAN(_Matcap2Mask, _MainTex, poiUV(poiMesh.uv[_Matcap2MaskUV], _Matcap2Mask_ST), _Matcap2MaskPan);
+ #else
+ matcap2Mask = 1;
+ #endif
+ if (_Matcap2MaskInvert)
+ {
+ matcap2Mask = 1 - matcap2Mask;
+ }
+
+ #ifdef TPS_Penetrator
+ if (_Matcap2TPSDepthEnabled)
+ {
+ matcap2Mask = lerp(matcap2Mask, 1, 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);
+ }
+
+ blendMatcap(poiLight, poiFragData, _Matcap2Add, _Matcap2AddToLight, _Matcap2Multiply, _Matcap2Replace, _Matcap2Mixed, matcap2, matcap2Mask, _Matcap2EmissionStrength, _Matcap2LightMask
+ #ifdef POI_BLACKLIGHT
+ , _BlackLightMaskMatcap2
+ #endif
+ );
+ #endif
+ }
+ #endif
+
+ #ifdef _CUBEMAP
+ void applyCubemap(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiMesh poiMesh, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ float3 CubeMapUV = 0;
+
+ switch(_CubeMapUVMode)
+ {
+ // Skybox
+ case 0:
+ {
+ CubeMapUV = -poiCam.viewDir;
+ break;
+ }
+ // Reflection
+ case 1:
+ {
+ CubeMapUV = poiCam.reflectionDir;
+ break;
+ }
+ }
+
+ #if defined(PROP_CUBEMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 cubeMap = texCUBE(_CubeMap, CubeMapUV);
+ cubeMap.rgb *= poiThemeColor(poiMods, _CubeMapColor, _CubeMapColorThemeIndex);
+ #else
+ float4 cubeMap = 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);
+ #else
+ float CubeMapMask = 1;
+ #endif
+
+ if (_CubeMapMaskInvert)
+ {
+ CubeMapMask = 1 - CubeMapMask;
+ }
+
+ //UNITY_BRANCH
+ if (_CubeMapHueShiftEnabled)
+ {
+ cubeMap.rgb = hueShift(cubeMap.rgb, _CubeMapHueShift + _Time.x * _CubeMapHueShiftSpeed);
+ }
+ CubeMapMask = min(CubeMapMask, lerp(1, poiLight.rampedLightMap, _CubeMapLightMask));
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, cubeMap.rgb, _CubeMapReplace * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb *= lerp(1, cubeMap.rgb, _CubeMapMultiply * CubeMapMask * cubeMap.a);
+ poiFragData.baseColor.rgb += cubeMap.rgb * _CubeMapAdd * CubeMapMask * cubeMap.a;
+ poiFragData.emission += cubeMap.rgb * _CubeMapEmissionStrength * CubeMapMask * cubeMap.a;
+ }
+ #endif
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ #ifdef _RIMSTYLE_POIYOMI
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ /*
+ #if defined(PROP_RIMWIDTHNOISETEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float rimNoise = POI2D_SAMPLER_PAN(_RimWidthNoiseTexture, _MainTex, poiUV(poiMesh.uv[_RimWidthNoiseTextureUV], _RimWidthNoiseTexture_ST), _RimWidthNoiseTexturePan);
+ #else
+ float rimNoise = 0;
+ #endif
+
+ rimNoise = (rimNoise - .5) * _RimWidthNoiseStrength;
+ */
+
+ float viewDotNormal = abs(dot(poiCam.viewDir, lerp(poiMesh.normals[0], poiMesh.normals[1], _Is_NormalMapToRimLight)));
+
+ UNITY_BRANCH
+ if (_RimLightingInvert)
+ {
+ viewDotNormal = 1 - viewDotNormal;
+ }
+
+ viewDotNormal = pow(viewDotNormal, _RimPower);
+
+ if (_RimShadowWidth && _RimShadowToggle)
+ {
+ viewDotNormal += lerp(0, (1 - poiLight.nDotLNormalized) * 3, _RimShadowWidth);
+ }
+
+ float rimStrength = _RimStrength;
+
+ float rimWidth = lerp( - .05, 1, _RimWidth);
+
+ float blendStrength = _RimBlendStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ rimWidth = clamp(rimWidth + lerp(_AudioLinkRimWidthAdd.x, _AudioLinkRimWidthAdd.y, poiMods.audioLink[_AudioLinkRimWidthBand]), - .05, 1);
+ blendStrength += lerp(_AudioLinkRimEmissionAdd.x, _AudioLinkRimEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ blendStrength += lerp(_AudioLinkRimBrightnessAdd.x, _AudioLinkRimBrightnessAdd.y, poiMods.audioLink[_AudioLinkRimBrightnessBand]);
+ }
+ #endif
+
+ //rimWidth -= rimNoise;
+
+ #if defined(PROP_RIMMASK) || !defined(OPTIMIZER_ENABLED)
+ float rimMask = POI2D_SAMPLER_PAN(_RimMask, _MainTex, poiUV(poiMesh.uv[_RimMaskUV], _RimMask_ST), _RimMaskPan);
+ #else
+ float rimMask = 1;
+ #endif
+
+ #if defined(PROP_RIMTEX) || !defined(OPTIMIZER_ENABLED)
+ float4 rimColor = POI2D_SAMPLER_PAN(_RimTex, _MainTex, poiUV(poiMesh.uv[_RimTexUV], _RimTex_ST), _RimTexPan) * float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #else
+ float4 rimColor = float4(poiThemeColor(poiMods, _RimLightColor.rgb, _RimLightColorThemeIndex), _RimLightColor.a);
+ #endif
+
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ rimColor.rgb = hueShift(rimColor.rgb, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+
+ rimWidth = max(lerp(rimWidth, rimWidth * lerp(0, 1, poiLight.lightMap - _ShadowMixThreshold) * _ShadowMixWidthMod, _ShadowMix), 0);
+ float rim = 1 - smoothstep(min(_RimSharpness, rimWidth), rimWidth, viewDotNormal);
+ rim *= _RimLightColor.a * rimColor.a * rimMask;
+
+ if (_RimShadowToggle)
+ {
+ switch(_RimShadowMaskRampType)
+ {
+ case 0: rim = lerp(rim, rim * poiLight.rampedLightMap, _RimShadowMaskStrength); break;
+ case 1: rim = lerp(rim, rim * smoothstep(_RimShadowAlpha.x, _RimShadowAlpha.y, poiLight.nDotLNormalized), _RimShadowMaskStrength); break;
+ }
+ }
+
+ float3 finalRimColor = rimColor.rgb * lerp(1, poiFragData.baseColor, _RimBaseColorMix);
+
+ // Add 0, Replace 1, Multiply 2, Mixed 3
+ switch(_RimBlendMode)
+ {
+ case 0: poiFragData.baseColor += finalRimColor * rim * blendStrength; break;
+ case 1: poiFragData.baseColor = lerp(poiFragData.baseColor, finalRimColor, rim * blendStrength); break;
+ case 2: poiFragData.baseColor = lerp(poiFragData.baseColor, poiFragData.baseColor * finalRimColor, rim * blendStrength); break;
+ case 3: poiFragData.baseColor = lerp(poiFragData.baseColor.rgb, poiFragData.baseColor.rgb + poiFragData.baseColor.rgb * finalRimColor, rim * blendStrength); break;
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor);
+ poiFragData.emission += finalRimColor * rim * rimStrength;
+ }
+ #endif
+ #ifdef _RIMSTYLE_UTS2
+ void ApplyRimLighting(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiLight poiLight, in PoiMods poiMods)
+ {
+ //float3 Set_HighColor = (lerp(saturate((Set_FinalBaseColor - _TweakHighColorMask_var)), Set_FinalBaseColor, lerp(_Is_BlendAddToHiColor, 1.0, _Is_SpecularToHighColor)) + lerp(_HighColor_var, (_HighColor_var * ((1.0 - Set_FinalShadowMask) + (Set_FinalShadowMask * _TweakHighColorOnShadow))), _Is_UseTweakHighColorOnShadow));
+ #if defined(PROP_SET_RIMLIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float4 _Set_RimLightMask_var = POI2D_SAMPLER_PAN(_Set_RimLightMask, _MainTex, poiUV(poiMesh.uv[_Set_RimLightMaskUV], _Set_RimLightMask_ST), _Set_RimLightMaskPan);
+ #else
+ float4 _Set_RimLightMask_var = float4(1.0, 1.0, 1.0, 1.0);
+ #endif
+ 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));
+ float _RimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _RimLight_Power)));
+ float _Rimlight_InsideMask_var = saturate(lerp((0.0 + ((_RimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _RimLightPower_var), _RimLight_FeatherOff));
+ float _VertHalfLambert_var = 0.5 * dot(poiMesh.normals[0], poiLight.direction) + 0.5;
+ float3 _LightDirection_MaskOn_var = lerp((_Is_LightColor_RimLight_var * _Rimlight_InsideMask_var), (_Is_LightColor_RimLight_var * saturate((_Rimlight_InsideMask_var - ((1.0 - _VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel)))), _LightDirection_MaskOn);
+ float _ApRimLightPower_var = pow(_RimArea_var, exp2(lerp(3, 0, _Ap_RimLight_Power)));
+ float3 ApRimColor = float3(poiThemeColor(poiMods, _Ap_RimLightColor.rgb, _RimApColorThemeIndex));
+ float3 _RimLight_var = (saturate((_Set_RimLightMask_var.g + _Tweak_RimLightMaskLevel)) * lerp(_LightDirection_MaskOn_var, (_LightDirection_MaskOn_var + (lerp(ApRimColor, (ApRimColor * poiLight.directColor), _Is_LightColor_Ap_RimLight) * saturate((lerp((0.0 + ((_ApRimLightPower_var - _RimLight_InsideMask) * (1.0 - 0.0)) / (1.0 - _RimLight_InsideMask)), step(_RimLight_InsideMask, _ApRimLightPower_var), _Ap_RimLight_FeatherOff) - (saturate(_VertHalfLambert_var) + _Tweak_LightDirection_MaskLevel))))), _Add_Antipodean_RimLight));
+ UNITY_BRANCH
+ if (_RimHueShiftEnabled)
+ {
+ _RimLight_var = hueShift(_RimLight_var, _RimHueShift + _Time.x * _RimHueShiftSpeed);
+ }
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _RimLight_var);
+ //Composition: HighColor and RimLight as _RimLight_var
+
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+
+ float3 RandomColorFromPoint(float2 rando)
+ {
+ fixed hue = random2(rando.x + rando.y).x;
+ fixed saturation = lerp(_GlitterMinMaxSaturation.x, _GlitterMinMaxSaturation.y, rando.x);
+ fixed value = lerp(_GlitterMinMaxBrightness.x, _GlitterMinMaxBrightness.y, rando.y);
+ 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)
+ {
+ // Scale
+ float2 st = frac(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;
+ float2 dank;
+ for (int j = -1; j <= 1; j++)
+ {
+ for (int i = -1; i <= 1; i++)
+ {
+ float2 neighbor = float2(i, j);
+ float2 pos = random2(i_st + neighbor);
+ float2 rando = pos;
+ pos = 0.5 + 0.5 * sin(_GlitterJitter * 6.2831 * pos);
+ float2 diff = neighbor + pos - f_st;
+ float dist = length(diff);
+
+ if (dist < m_dist)
+ {
+ dank = diff;
+ m_dist = dist;
+ m_point = pos;
+ randoPoint = rando;
+ }
+ }
+ }
+
+ float randomFromPoint = random(randoPoint);
+
+ float size = _GlitterSize;
+ UNITY_BRANCH
+ if (_GlitterRandomSize)
+ {
+ size = remapClamped(0, 1, randomFromPoint, _GlitterMinMaxSize.x, _GlitterMinMaxSize.y);
+ }
+
+ // 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)
+ {
+ case 0: //circle
+ glitterAlpha = 1 - saturate((m_dist - size) / clamp(fwidth(m_dist), 0.0001, 1.0));
+ break;
+ case 1: //sqaure
+ float jaggyFix = pow(poiCam.distanceToVert, 2) * _GlitterJaggyFix;
+
+ UNITY_BRANCH
+ if (_GlitterRandomRotation == 1 || _GlitterTextureRotation != 0)
+ {
+ float2 center = float2(0, 0);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ dank = float2((dank.x - center.x) * cs - (dank.y - center.y) * sn + center.x, (dank.x - center.x) * sn + (dank.y - center.y) * cs + center.y);
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ else
+ {
+ glitterAlpha = (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.x))) * (1. - smoothstep(size - .1 * jaggyFix, size, abs(dank.y)));
+ }
+ break;
+ }
+
+ float3 finalGlitter = 0;
+
+ half3 glitterColor = poiThemeColor(poiMods, _GlitterColor, _GlitterColorThemeIndex);
+
+ float3 norm = poiMesh.normals[1];
+ float3 randomRotation = 0;
+ switch(_GlitterMode)
+ {
+ case 0:
+ UNITY_BRANCH
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ 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;
+ break;
+ case 1:
+ float offset = random(randoPoint);
+ float brightness = sin((_Time.x + offset) * _GlitterSpeed) * _glitterFrequencyLinearEmissive - (_glitterFrequencyLinearEmissive - 1);
+ finalGlitter = max(_GlitterMinBrightness * glitterAlpha, brightness * glitterAlpha * smoothstep(0, 1, 1 - m_dist * _GlitterCenterSize * 10));
+ break;
+ case 2:
+ if (_GlitterSpeed > 0)
+ {
+ randomRotation = randomFloat3WiggleRange(randoPoint, _GlitterAngleRange, _GlitterSpeed);
+ }
+ else
+ {
+ randomRotation = randomFloat3Range(randoPoint, _GlitterAngleRange);
+ }
+
+ float3 glitterLightReflectionDirection = normalize(mul(poiRotationMatrixFromAngles(randomRotation), norm));
+
+ #ifdef UNITY_PASS_FORWARDADD
+ glitterAlpha *= poiLight.nDotLSaturated * poiLight.attenuation;
+ #endif
+ #ifdef UNITY_PASS_FORWARDBASE
+ glitterAlpha *= poiLight.nDotLSaturated;
+ #endif
+
+ 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 && !_GlitterShape)
+ {
+ float2 fakeUVCenter = float2(.5, .5);
+ float randomBoy = 0;
+ UNITY_BRANCH
+ if (_GlitterRandomRotation)
+ {
+ randomBoy = random(randoPoint);
+ }
+ float theta = radians((randomBoy + _Time.x * _GlitterTextureRotation) * 360);
+ float cs = cos(theta);
+ 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_PAN(_GlitterTexture, _MainTex, poiUV(uv, _GlitterTexture_ST), _GlitterTexturePan);
+ #else
+ float4 glitterTexture = 1;
+ #endif
+ //float4 glitterTexture = _GlitterTexture.SampleGrad(sampler_MainTex, frac(uv), ddx(uv), ddy(uv));
+ glitterColor *= glitterTexture.rgb;
+ #if defined(PROP_GLITTERMASK) || !defined(OPTIMIZER_ENABLED)
+ float glitterMask = POI2D_SAMPLER_PAN(_GlitterMask, _MainTex, poiUV(poiMesh.uv[_GlitterMaskUV], _GlitterMask_ST), _GlitterMaskPan);
+ #else
+ float glitterMask = 1;
+ #endif
+
+ glitterMask *= lerp(1, poiLight.rampedLightMap, _GlitterHideInShadow);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskGlitter != 4)
+ {
+ glitterMask *= blackLightMask[_BlackLightMaskGlitter];
+ }
+ #endif
+
+ if (_GlitterRandomColors)
+ {
+ glitterColor *= RandomColorFromPoint(random2(randoPoint.x + randoPoint.y));
+ }
+
+ UNITY_BRANCH
+ if (_GlitterHueShiftEnabled)
+ {
+ glitterColor.rgb = hueShift(glitterColor.rgb, _GlitterHueShift + _Time.x * _GlitterHueShiftSpeed);
+ }
+
+ UNITY_BRANCH
+ if (_GlitterBlendType == 1)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, finalGlitter * glitterColor * _GlitterBrightness, finalGlitter * glitterTexture.a * glitterMask);
+ poiFragData.emission += finalGlitter * glitterColor * max(0, (_GlitterBrightness - 1) * glitterTexture.a) * glitterMask;
+ }
+ else
+ {
+ poiFragData.emission += finalGlitter * glitterColor * _GlitterBrightness * glitterTexture.a * glitterMask;
+ }
+ }
+ #endif
+
+ #if defined(MOCHIE_PBR) || defined(POI_CLEARCOAT)
+
+ /*
+ * Copyright 2022 orels1
+ *
+ * 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 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;
+ reflDir = BoxProjection(reflDir, worldPos, unity_SpecCube0_ProbePosition, unity_SpecCube0_BoxMin, unity_SpecCube0_BoxMax);
+ float4 envSample0 = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0, reflDir, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p0 = DecodeHDR(envSample0, unity_SpecCube0_HDR);
+ float interpolator = unity_SpecCube0_BoxMin.w;
+ UNITY_BRANCH
+ if (interpolator < 0.99999)
+ {
+ float3 refDirBlend = BoxProjection(baseReflDir, worldPos, unity_SpecCube1_ProbePosition, unity_SpecCube1_BoxMin, unity_SpecCube1_BoxMax);
+ float4 envSample1 = UNITY_SAMPLE_TEXCUBE_SAMPLER_LOD(unity_SpecCube1, unity_SpecCube0, refDirBlend, roughness * UNITY_SPECCUBE_LOD_STEPS);
+ float3 p1 = DecodeHDR(envSample1, unity_SpecCube1_HDR);
+ p0 = lerp(p1, p0, interpolator);
+ }
+ return p0;
+ }
+
+ float3 GetReflections(in PoiCam poiCam, in PoiLight pl, in PoiMesh poiMesh, float roughness, float ForceFallback, float LightFallback, samplerCUBE reflectionCube, float3 reflectionDir)
+ {
+ float3 reflections = 0;
+ float3 lighting = pl.finalLighting;
+ if (ForceFallback == 0)
+ {
+ UNITY_BRANCH
+ if (SceneHasReflections())
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = GetWorldReflections(reflectionDir, poiMesh.worldPos.xyz, roughness);
+ #endif
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ }
+ else
+ {
+ #ifdef UNITY_PASS_FORWARDBASE
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * lerp(1, pl.finalLighting, LightFallback);
+ #endif
+ #ifdef POI_PASS_ADD
+ if (LightFallback)
+ {
+ reflections = texCUBElod(reflectionCube, float4(reflectionDir, roughness * UNITY_SPECCUBE_LOD_STEPS));
+ reflections = DecodeHDR(float4(reflections, 1), _MochieReflCube_HDR) * pl.finalLighting;
+ }
+ #endif
+ }
+ reflections *= pl.occlusion;
+ return reflections;
+ }
+
+ float GetGGXTerm(float nDotL, float nDotV, float nDotH, float roughness)
+ {
+ float visibilityTerm = 0;
+ if (nDotL > 0)
+ {
+ 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;
+ rough *= 1.7 - 0.7 * rough;
+ return rough;
+ }
+ #endif
+
+ #ifdef MOCHIE_PBR
+ void MochieBRDF(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float smoothness = _MochieRoughnessMultiplier;
+ float smoothness2 = _MochieRoughnessMultiplier2;
+ float metallic = _MochieMetallicMultiplier;
+ float specularMask = 1;
+ float reflectionMask = 1;
+
+ #if defined(PROP_MOCHIEMETALLICMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMapsUV], _MochieMetallicMaps_ST), _MochieMetallicMapsPan.xy);
+ UNITY_BRANCH
+ if (_PBRSplitMaskSample)
+ {
+ PRBMaps.zw = POI2D_SAMPLER_PAN(_MochieMetallicMaps, _MainTex, poiUV(poiMesh.uv[_MochieMetallicMasksUV], _PBRMaskScaleTiling), _MochieMetallicMasksPan.xy).zw;
+ }
+ metallic *= PRBMaps.r;
+ smoothness = (smoothness * PRBMaps.g);
+ smoothness2 = (smoothness2 * PRBMaps.g);
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_MochieSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+ if (_MochieReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+
+ #ifdef TPS_Penetrator
+ reflectionMask = lerp(0, reflectionMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSReflectionMaskStrength);
+ specularMask = lerp(0, specularMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _BRDFTPSSpecularMaskStrength);
+ #endif
+
+ if (_MochieRoughnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ smoothness2 = 1 - smoothness2;
+ }
+ float roughness = GetRoughness(smoothness);
+ float roughness2 = GetRoughness(smoothness2);
+ if (_MochieMetallicMapInvert)
+ {
+ metallic = 1 - metallic;
+ }
+ float3 specCol = lerp(unity_ColorSpaceDielectricSpec.rgb, poiFragData.baseColor, metallic);
+ float omr = unity_ColorSpaceDielectricSpec.a - metallic * unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ float percepRough2 = 1 - smoothness2;
+ UNITY_BRANCH
+ if (_MochieGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _PoiGSAAVariance, _PoiGSAAThreshold);
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ percepRough2 = GSAA_Filament(poiMesh.normals[1], percepRough2, _PoiGSAAVariance, _PoiGSAAThreshold);
+ }
+ }
+ 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;
+ float3 vSpecular = 0;
+ float3 vSpecular2 = 0;
+ float3 reflections = 0;
+ float3 environment = 0;
+
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _IgnoreCastedShadows));
+
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_MochieSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_Specular2ndLayer == 1 && _MochieSpecularStrength2 > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.nDotL, poiLight.nDotV, poiLight.nDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ specular2 = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _MochieSpecularStrength2;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vDotNL[index], poiLight.nDotV, poiLight.vDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness2);
+ vSpecular2 += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _MochieSpecularTint, _MochieSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _MochieSpecularStrength2;
+ }
+ #endif
+ }
+
+ if (_MochieReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _MochieForceFallback, _MochieLitFallback, _MochieReflCube, poiCam.reflectionDir);
+ float reflStr = reflectionMask * _MochieReflectionStrength;
+ reflections = surfaceReduction * reflCol * lerp(1, FresnelLerp(specCol, grazingTerm, poiLight.nDotV), _RefSpecFresnel);
+ reflections *= poiThemeColor(poiMods, _MochieReflectionTint, _MochieReflectionTintThemeIndex);
+ reflections *= reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = max(specular + vSpecular, specular2 + vSpecular2);
+ environment += reflections;
+ diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor = diffuse;
+ }
+ #endif
+
+ #ifdef POI_CLEARCOAT
+ void poiClearCoat(inout PoiFragData poiFragData, in PoiCam poiCam, in PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float clearCoatMask = _ClearCoatStrength;
+ float smoothness = _ClearCoatSmoothness;
+ float reflectionMask = 1;
+ float specularMask = 1;
+
+ #if defined(PROP_CLEARCOATMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 PRBMaps = POI2D_SAMPLER_PAN(_ClearCoatMaps, _MainTex, poiUV(poiMesh.uv[_ClearCoatMapsUV], _ClearCoatMaps_ST), _ClearCoatMapsPan);
+ clearCoatMask *= PRBMaps.r;
+ smoothness *= PRBMaps.g;
+ reflectionMask *= PRBMaps.b;
+ specularMask *= PRBMaps.a;
+ #endif
+
+ if (_ClearCoatMaskInvert)
+ {
+ clearCoatMask = 1 - clearCoatMask;
+ }
+
+ #ifdef TPS_Penetrator
+ clearCoatMask = lerp(0, clearCoatMask * TPSBufferedDepth(poiMesh.localPos, poiMesh.vertexColor), _ClearCoatTPSMaskStrength);
+ #endif
+
+ if (_ClearCoatSmoothnessMapInvert)
+ {
+ smoothness = 1 - smoothness;
+ }
+ if (_ClearCoatReflectionMaskInvert)
+ {
+ reflectionMask = 1 - reflectionMask;
+ }
+ if (_ClearCoatSpecularMaskInvert)
+ {
+ specularMask = 1 - specularMask;
+ }
+
+ float roughness = GetRoughness(smoothness);
+ float3 specCol = 0.220916301;
+ float omr = unity_ColorSpaceDielectricSpec.a;
+ float percepRough = 1 - smoothness;
+ UNITY_BRANCH
+ if (_ClearCoatGSAAEnabled)
+ {
+ percepRough = GSAA_Filament(poiMesh.normals[1], percepRough, _ClearCoatGSAAVariance, _ClearCoatGSAAThreshold);
+ }
+ 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));
+ // Specular
+ // if (_SpecularMode == 0){
+ if (_ClearCoatSpecularStrength > 0)
+ {
+ float3 fresnelTerm = 1;
+ float3 specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexNDotL, poiLight.vertexNDotV, poiLight.vertexNDotH, poiLight.lDotH, specularTerm, fresnelTerm, specCol, brdfRoughness);
+ specular = poiLight.directColor * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * attenuation * _ClearCoatSpecularStrength;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ fresnelTerm = 1;
+ specularTerm = 1;
+ GetSpecFresTerm(poiLight.vertexVDotNL[index], poiLight.vertexNDotV, poiLight.vertexVDotNH[index], poiLight.vDotLH[index], specularTerm, fresnelTerm, specCol, brdfRoughness);
+ vSpecular += poiLight.vColor[index] * specularTerm * fresnelTerm * specularMask * poiThemeColor(poiMods, _ClearCoatSpecularTint, _ClearCoatSpecularTintThemeIndex) * poiLight.occlusion * poiLight.vAttenuation[index] * _ClearCoatSpecularStrength;
+ }
+ #endif
+ }
+
+ if (_ClearCoatReflectionStrength > 0)
+ {
+ float surfaceReduction = (1.0 / (brdfRoughness * brdfRoughness + 1.0));
+ float grazingTerm = saturate(smoothness + (1 - omr));
+ float3 reflCol = GetReflections(poiCam, poiLight, poiMesh, roughness, _ClearCoatForceFallback, _ClearCoatLitFallback, _ClearCoatFallback, poiCam.vertexReflectionDir);
+ float reflStr = reflectionMask * _ClearCoatReflectionStrength;
+ reflections = surfaceReduction * reflCol * FresnelLerp(specCol, grazingTerm, poiLight.vertexNDotV);
+ reflections *= poiThemeColor(poiMods, _ClearCoatReflectionTint, _ClearCoatReflectionTintThemeIndex) * reflStr;
+ #ifdef UNITY_PASS_FORWARDADD
+ reflections *= poiLight.attenuation;
+ #endif
+ diffuse = lerp(diffuse, diffuse * omr, reflStr);
+ }
+
+ environment = specular + vSpecular;
+ #ifdef UNITY_PASS_FORWARDBASE
+ environment += reflections;
+ #endif
+ //diffuse *= poiLight.finalLighting;
+ diffuse += environment;
+ poiFragData.finalColor += saturate(diffuse * clearCoatMask);
+ }
+ #endif
+
+ #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
+ if (interpolator < 0.99999)
+ {
+ //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
+ {
+ 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 = poiMax(POI2D_SAMPLER_PAN(_RimEnviroMask, _MainTex, poiMesh.uv[_RimEnviroMaskUV], _RimEnviroMaskPan).rgb);
+ #endif
+ float3 envRimCol = lerp(0, max(0, (enviroRimColor - _RimEnviroMinBrightness) * poiFragData.baseColor), enviroRimAlpha).rgb * enviroMask * _RimEnviroIntensity;
+ poiFragData.finalColor += envRimCol;
+ }
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ void stylizedSpecular(inout PoiFragData poiFragData, in PoiCam poiCam, inout PoiLight poiLight, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float specArea = 0.5 * poiLight.nDotH + 0.5;
+ #if defined(PROP_HIGHCOLOR_TEX) || !defined(OPTIMIZER_ENABLED)
+ float3 specularMap = POI2D_SAMPLER_PAN(_HighColor_Tex, _MainTex, poiUV(poiMesh.uv[_HighColor_TexUV], _HighColor_Tex_ST), _HighColor_TexPan);
+ #else
+ float3 specularMap = 1;
+ #endif
+
+ // Spec 1
+ float specMask1 = 0;
+ float specMask2 = 0;
+ if (_Is_SpecularToHighColor)
+ {
+ specMask1 += pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength;
+ specMask2 += pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength;
+ }
+ else
+ {
+ specMask1 += aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength;
+ specMask2 += aaBlurStep(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).g;
+ #else
+ float specularMask = 1;
+ #endif
+
+ specularMask = saturate(specularMask + _Tweak_HighColorMaskLevel);
+
+ float specMask = saturate(specMask1 + specMask2) * specularMask * poiLight.rampedLightMap;
+ float attenuation = min(poiLight.nDotLSaturated, lerp(poiLight.attenuation, 1, _SSIgnoreCastedShadows));
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor) * specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * lerp(1, poiLight.directColor, _UseLightColor), saturate(specMask * poiLight.occlusion * attenuation * _StylizedSpecularStrength));
+ }
+ //poiFragData.baseColor = _StylizedSpecularStrength;
+
+ float3 vSpecMask = 0;
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ for (int index = 0; index < 4; index++)
+ {
+ specArea = 0.5 * poiLight.vDotNH[index] + 0.5;
+ if (_Is_SpecularToHighColor)
+ {
+ vSpecMask = pow(specArea, exp2(lerp(11, 1, _HighColor_Power))) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, pow(specArea, exp2(lerp(11, 1, _Layer2Size))) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ else
+ {
+ vSpecMask = aaBlurStep(specArea, (1.0 - pow(_HighColor_Power, 5)), _StylizedSpecularFeather) * _Layer1Strength * poiLight.vAttenuation * poiLight.vColor[index];
+ vSpecMask = max(vSpecMask, aaBlurStep(specArea, (1.0 - pow(_Layer2Size, 5)), _StylizedSpecular2Feather) * _Layer2Strength * poiLight.vAttenuation * poiLight.vColor[index]);
+ }
+ }
+ vSpecMask *= specularMask;
+ if (_Is_BlendAddToHiColor == 1)
+ {
+ poiLight.finalLightAdd += max(0, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex) * vSpecMask * poiLight.occlusion * _StylizedSpecularStrength);
+ }
+ else
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, specularMap * poiThemeColor(poiMods, _HighColor, _HighColorThemeIndex), saturate(vSpecMask * poiLight.occlusion * _StylizedSpecularStrength));
+ }
+ #endif
+ }
+ #endif
+
+ #ifdef POI_PATHING
+ void applyPathing(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float3 albedo = poiFragData.baseColor;
+ float3 pathEmission;
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ float4 path = _PathingMap.Sample(SmpRepeatPoint, poiUV(poiMesh.uv[_PathingMapUV], _PathingMap_ST) + _PathingMapPan.xy * _Time.x);
+ #else
+ float4 path = float4(1, 1, 1, 1);
+ #endif
+ float4 PathColor[4];
+ half pathAudioLinkPathTimeOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkTimeOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ half pathAudioLinkPathWidthOffsetBand[4] = {
+ 0, 0, 0, 0
+ };
+ half2 pathAudioLinkWidthOffset[4] = {
+ half2(0, 0), half2(0, 0), half2(0, 0), half2(0, 0)
+ };
+ PathColor[0] = _PathColorR;
+ 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);
+ float4 chronoSpeed = float4(_PathChronoSpeedR, _PathChronoSpeedG, _PathChronoSpeedB, _PathChronoSpeedA);
+ float4 autoCorrelator = float4(_PathALAutoCorrelatorR, _PathALAutoCorrelatorG, _PathALAutoCorrelatorB, _PathALAutoCorrelatorA);
+ float2 history[4] = {
+ float2(_PathALHistoryR, _PathALHistoryBandR), float2(_PathALHistoryG, _PathALHistoryBandG), float2(_PathALHistoryB, _PathALHistoryBandB), float2(_PathALHistoryA, _PathALHistoryBandA)
+ };
+
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ pathAudioLinkPathTimeOffsetBand[0] = _AudioLinkPathTimeOffsetBandR;
+ pathAudioLinkPathTimeOffsetBand[1] = _AudioLinkPathTimeOffsetBandG;
+ pathAudioLinkPathTimeOffsetBand[2] = _AudioLinkPathTimeOffsetBandB;
+ pathAudioLinkPathTimeOffsetBand[3] = _AudioLinkPathTimeOffsetBandA;
+ pathAudioLinkTimeOffset[0] = _AudioLinkPathTimeOffsetR.xy;
+ pathAudioLinkTimeOffset[1] = _AudioLinkPathTimeOffsetG.xy;
+ pathAudioLinkTimeOffset[2] = _AudioLinkPathTimeOffsetB.xy;
+ pathAudioLinkTimeOffset[3] = _AudioLinkPathTimeOffsetA.xy;
+ }
+
+ if (_PathALWidthOffset)
+ {
+ pathAudioLinkPathWidthOffsetBand[0] = _AudioLinkPathWidthOffsetBandR;
+ pathAudioLinkPathWidthOffsetBand[1] = _AudioLinkPathWidthOffsetBandG;
+ pathAudioLinkPathWidthOffsetBand[2] = _AudioLinkPathWidthOffsetBandB;
+ pathAudioLinkPathWidthOffsetBand[3] = _AudioLinkPathWidthOffsetBandA;
+ pathAudioLinkWidthOffset[0] = _AudioLinkPathWidthOffsetR.xy;
+ pathAudioLinkWidthOffset[1] = _AudioLinkPathWidthOffsetG.xy;
+ pathAudioLinkWidthOffset[2] = _AudioLinkPathWidthOffsetB.xy;
+ pathAudioLinkWidthOffset[3] = _AudioLinkPathWidthOffsetA.xy;
+ }
+ // Emission Offset
+ if (_PathALEmissionOffset)
+ {
+ pathAudioLinkEmission.r += lerp(_AudioLinkPathEmissionAddR.x, _AudioLinkPathEmissionAddR.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandR]);
+ pathAudioLinkEmission.g += lerp(_AudioLinkPathEmissionAddG.x, _AudioLinkPathEmissionAddG.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandG]);
+ pathAudioLinkEmission.b += lerp(_AudioLinkPathEmissionAddB.x, _AudioLinkPathEmissionAddB.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandB]);
+ pathAudioLinkEmission.a += lerp(_AudioLinkPathEmissionAddA.x, _AudioLinkPathEmissionAddA.y, poiMods.audioLink[_AudioLinkPathEmissionAddBandA]);
+ }
+
+ if (_PathALCCR)
+ {
+ PathColor[0] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[0] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCG)
+ {
+ PathColor[1] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[1] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCB)
+ {
+ PathColor[2] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[2] * AUDIOLINK_WIDTH, 0));
+ }
+ if (_PathALCCA)
+ {
+ PathColor[3] *= AudioLinkLerp(ALPASS_CCSTRIP + float2(path[3] * AUDIOLINK_WIDTH, 0));
+ }
+ }
+ #endif
+
+ [unroll]
+ for (int index = 0; index < 4; index++)
+ {
+ float timeOffset = 0;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALTimeOffset)
+ {
+ timeOffset += lerp(pathAudioLinkTimeOffset[index].x, pathAudioLinkTimeOffset[index].y, poiMods.audioLink[pathAudioLinkPathTimeOffsetBand[index]]);
+ }
+
+ if (_PathALChrono)
+ {
+ timeOffset += AudioLinkGetChronoTime(chronoType[index], chronoBand[index]) * chronoSpeed[index];
+ }
+ }
+ #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
+ half pathWidth = _PathWidth[index] * .5;
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_PathALWidthOffset)
+ {
+ pathWidth += lerp(pathAudioLinkWidthOffset[index].x, pathAudioLinkWidthOffset[index].y, poiMods.audioLink[pathAudioLinkPathWidthOffsetBand[index]]);
+ }
+ }
+ #endif
+
+ //fill
+ pathAlpha[index].x = pathTime[index] > path[index];
+ //path
+ pathAlpha[index].y = saturate((1 - abs(lerp(-pathWidth, 1 + pathWidth, pathTime[index]) - path[index])) - (1 - pathWidth)) * (1 / pathWidth);
+ //loop
+ 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)
+ {
+ if (_PathALHistory && history[index].x)
+ {
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUDIOLINK + float2(path[index] * AUDIOLINK_WIDTH, history[index].y)).r;
+ }
+
+ if (_PathALAutoCorrelator && autoCorrelator[index] != 0)
+ {
+ float autoCorrelatorUV = path[index];
+ if (autoCorrelator[index] == 2)
+ {
+ autoCorrelatorUV = abs(1. - path[index] * 2.);
+ }
+ pathAlpha[index] *= AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2(autoCorrelatorUV * AUDIOLINK_WIDTH, 0)).r;
+ }
+ }
+ #endif
+ }
+ }
+
+ // Emission
+ pathEmission = 0;
+ pathEmission += pathAlpha[0][_PathTypeR] * poiThemeColor(poiMods, PathColor[0].rgb, _PathColorRThemeIndex) * (_PathEmissionStrength[0] + pathAudioLinkEmission.r);
+ pathEmission += pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * (_PathEmissionStrength[1] + pathAudioLinkEmission.g);
+ 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]);
+ colorReplace = pathAlpha[1][_PathTypeG] * poiThemeColor(poiMods, PathColor[1].rgb, _PathColorGThemeIndex) * pathColorMap.rgb;
+ albedo.rgb = lerp(albedo.rgb, colorReplace + albedo.rgb * 0.00001, pathColorMap.a * PathColor[1].a * pathAlpha[1][_PathTypeG]);
+ colorReplace = pathAlpha[2][_PathTypeB] * poiThemeColor(poiMods, PathColor[2].rgb, _PathColorBThemeIndex) * pathColorMap.rgb;
+ 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
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ float3 calculateNormal(PoiMesh poiMesh, float3 baseNormal)
+ {
+ float3 normal = baseNormal;
+ #if defined(PROP_IRIDESCENCENORMALMAP) || !defined(OPTIMIZER_ENABLED)
+ normal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_IridescenceNormalMap, _MainTex, poiUV(poiMesh.uv[_IridescenceNormalMapUV], _IridescenceNormalMap_ST), _IridescenceNormalMapPan), _IridescenceNormalIntensity);
+ normal = normalize(normal.x * poiMesh.tangent + normal.y * poiMesh.binormal + normal.z * baseNormal);
+ #endif
+ return normal;
+ }
+
+ void applyIridescence(inout PoiFragData poiFragData, PoiMesh poiMesh, PoiCam poiCam, inout PoiMods poiMods)
+ {
+ float3 normal = poiMesh.normals[_IridescenceNormalSelection];
+ if (_IridescenceNormalToggle)
+ {
+ normal = calculateNormal(poiMesh, normal);
+ }
+ float ndotv = dot(normal, poiCam.viewDir);
+
+ float4 iridescenceColor = 0;
+ #if defined(PROP_IRIDESCENCERAMP) || !defined(OPTIMIZER_ENABLED)
+ iridescenceColor = UNITY_SAMPLE_TEX2D_SAMPLER(_IridescenceRamp, _MainTex, (1 - abs(ndotv)) * _IridescenceRamp_ST.xy + _IridescenceRampPan * _Time.x + _IridescenceRamp_ST.zw);
+ if (_IridescenceHueShiftEnabled == 1)
+ {
+ float hue = _IridescenceHueShift + frac(_Time.x * _IridescenceHueShiftSpeed);
+ iridescenceColor.rgb = hueShift(iridescenceColor.rgb, hue);
+ }
+ #endif
+
+ float iridescenceMask = 1;
+ #if defined(PROP_IRIDESCENCEMASK) || !defined(OPTIMIZER_ENABLED)
+ iridescenceMask = POI2D_SAMPLER_PAN(_IridescenceMask, _MainTex, poiUV(poiMesh.uv[_IridescenceMaskUV], _IridescenceMask_ST), _IridescenceMaskPan);
+ #endif
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskIridescence != 4)
+ {
+ iridescenceMask *= blackLightMask[_BlackLightMaskIridescence];
+ }
+ #endif
+
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor.rgb, saturate(iridescenceColor.rgb * _IridescenceIntensity), iridescenceColor.a * _IridescenceReplaceBlend * iridescenceMask);
+ poiFragData.baseColor.rgb += saturate(iridescenceColor.rgb * _IridescenceIntensity * iridescenceColor.a * _IridescenceAddBlend * iridescenceMask);
+ poiFragData.baseColor.rgb *= saturate(lerp(1, iridescenceColor.rgb * _IridescenceIntensity, iridescenceColor.a * _IridescenceMultiplyBlend * iridescenceMask));
+
+ float emissionStrength = _IridescenceEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (any(_IridescenceAudioLinkEmissionAdd))
+ {
+ emissionStrength += lerp(_IridescenceAudioLinkEmissionAdd.x, _IridescenceAudioLinkEmissionAdd.y, poiMods.audioLink[_AudioLinkRimEmissionBand]);
+ }
+ #endif
+ poiFragData.emission += saturate(iridescenceColor.rgb * _IridescenceIntensity) * iridescenceColor.a * iridescenceMask * emissionStrength;
+ }
+ #endif
+
+ #ifdef EFFECT_BUMP
+
+ float2 TransformUV(float2 offset, float rotation, float2 scale, float2 uv)
+ {
+ float theta = radians(rotation);
+ scale = 1 - scale;
+ float cs = cos(theta);
+ 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);
+ float3 absCameraPos = abs(cameraPos);
+ float totalCharacters = 20;
+ float positionArray[20];
+ positionArray[0] = cameraPos.x >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[1] = floor((absCameraPos.x * .01) % 10) + 48;
+ positionArray[2] = floor((absCameraPos.x * .1) % 10) + 48;
+ positionArray[3] = floor(absCameraPos.x % 10) + 48;
+ positionArray[4] = ASCII_PERIOD;
+ positionArray[5] = floor((absCameraPos.x * 10) % 10) + 48;
+ positionArray[6] = ASCII_COMMA;
+ positionArray[7] = cameraPos.y >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[8] = floor((absCameraPos.y * .01) % 10) + 48;
+ positionArray[9] = floor((absCameraPos.y * .1) % 10) + 48;
+ positionArray[10] = floor(absCameraPos.y % 10) + 48;
+ positionArray[11] = ASCII_PERIOD;
+ positionArray[12] = floor((absCameraPos.y * 10) % 10) + 48;
+ positionArray[13] = ASCII_COMMA;
+ positionArray[14] = cameraPos.z >= 0 ? ASCII_NEGATIVE : ASCII_POSITIVE;
+ positionArray[15] = floor((absCameraPos.z * .01) % 10) + 48;
+ positionArray[16] = floor((absCameraPos.z * .1) % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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;
+ float hours = instanceTime / 3600;
+ float minutes = (instanceTime / 60) % 60;
+ float seconds = instanceTime % 60;
+ float totalCharacters = 8;
+ float timeArray[8];
+ timeArray[0] = floor((hours * .1) % 10) + 48;
+ timeArray[1] = floor(hours % 10) + 48;
+ timeArray[2] = ASCII_SEMICOLON;
+ timeArray[3] = floor((minutes * .1) % 10) + 48;
+ timeArray[4] = floor(minutes % 10) + 48;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ 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);
+ float totalCharacters = 7;
+ float fpsArray[7];
+ fpsArray[0] = ASCII_F;
+ fpsArray[1] = ASCII_P;
+ fpsArray[2] = ASCII_S;
+ fpsArray[3] = ASCII_SEMICOLON;
+ 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;
+ sigDist *= max(dot(msdfUnit, 0.5 / fwidth(uv)), 1);
+ float opacity = clamp(sigDist + 0.5, 0, 1);
+ poiFragData.baseColor = lerp(poiFragData.baseColor, poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex), opacity * _TextFPSColor.a);
+ globalTextEmission += poiThemeColor(poiMods, _TextFPSColor.rgb, _TextFPSColorThemeIndex) * opacity * _TextFPSEmissionStrength;
+ }
+
+ 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)
+ ApplyPositionText(poiFragData, poiMesh.uv[_TextPositionUV], poiMods);
+ if (_TextTimeEnabled == 1)
+ ApplyTimeText(poiFragData, poiMesh.uv[_TextTimeUV], poiMods);
+
+ poiFragData.emission += globalTextEmission;
+ }
+ #endif
+
+ #ifdef POSTPROCESS
+ float oetf_sRGB_scalar(float L) {
+ float V = 1.055 * (pow(L, 1.0 / 2.4)) - 0.055;
+ if (L <= 0.0031308)
+ 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);
+ if (V <= oetf_sRGB_scalar(0.0031308))
+ 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 *= _PPTint;
+ col *= _PPRGB;
+ col = GetSaturation(col, _PPSaturation);
+ col = lerp(col, GetHDR(col), _PPHDR);
+ col = GetContrast(col, _PPContrast);
+ col *= _PPBrightness;
+ col += _PPLightness;
+
+ #if defined(PROP_PPMASK) || !defined(OPTIMIZER_ENABLED)
+ float ppMask = POI2D_SAMPLER_PAN(_PPMask, _MainTex, poiUV(poiMesh.uv[_PPMaskUV], _PPMask_ST), _PPMaskPan).r;
+ ppMask = lerp(ppMask, 1-ppMask, _PPMaskInvert);
+ col = lerp(poiFragData.finalColor, col, ppMask);
+ #endif
+
+ poiFragData.finalColor = col;
+ }
+ #endif
+
+ float4 frag(v2f 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ calculateGlobalThemes(poiMods);
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ poiLight.finalLightAdd = 0;
+ #if defined(PROP_LIGHTINGAOMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 AOMaps = POI2D_SAMPLER_PAN(_LightingAOMaps, _MainTex, poiUV(poiMesh.uv[_LightingAOMapsUV], _LightingAOMaps_ST), _LightingAOMapsPan);
+ poiLight.occlusion = lerp(1, AOMaps.r, _LightDataAOStrengthR) * lerp(1, AOMaps.g, _LightDataAOStrengthG) * lerp(1, AOMaps.b, _LightDataAOStrengthB) * lerp(1, AOMaps.a, _LightDataAOStrengthA);
+ #else
+ poiLight.occlusion = 1;
+ #endif
+ #if defined(PROP_LIGHTINGDETAILSHADOWMAPS) || !defined(OPTIMIZER_ENABLED)
+ float4 DetailShadows = POI2D_SAMPLER_PAN(_LightingDetailShadowMaps, _MainTex, poiUV(poiMesh.uv[_LightingDetailShadowMapsUV], _LightingDetailShadowMaps_ST), _LightingDetailShadowMapsPan);
+ poiLight.detailShadow = lerp(1, DetailShadows.r, _LightingDetailShadowStrengthR) * lerp(1, DetailShadows.g, _LightingDetailShadowStrengthG) * lerp(1, DetailShadows.b, _LightingDetailShadowStrengthB) * lerp(1, DetailShadows.a, _LightingDetailShadowStrengthA);
+ #else
+ poiLight.detailShadow = 1;
+ #endif
+ #if defined(PROP_LIGHTINGSHADOWMASKS) || !defined(OPTIMIZER_ENABLED)
+ float4 ShadowMasks = POI2D_SAMPLER_PAN(_LightingShadowMasks, _MainTex, poiUV(poiMesh.uv[_LightingShadowMasksUV], _LightingShadowMasks_ST), _LightingShadowMasksPan);
+ poiLight.shadowMask = lerp(1, ShadowMasks.r, _LightingShadowMaskStrengthR) * lerp(1, ShadowMasks.g, _LightingShadowMaskStrengthG) * lerp(1, ShadowMasks.b, _LightingShadowMaskStrengthB) * lerp(1, ShadowMasks.a, _LightingShadowMaskStrengthA);
+ #else
+ poiLight.shadowMask = 1;
+ #endif
+
+ #ifdef UNITY_PASS_FORWARDBASE
+
+ bool lightExists = false;
+ if (any(_LightColor0.rgb >= 0.002))
+ {
+ lightExists = true;
+ }
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ float4 toLightX = unity_4LightPosX0 - i.worldPos.x;
+ float4 toLightY = unity_4LightPosY0 - i.worldPos.y;
+ float4 toLightZ = unity_4LightPosZ0 - i.worldPos.z;
+ float4 lengthSq = 0;
+ 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.vAttenuationDotNL = saturate(poiLight.vAttenuation * saturate(poiLight.vDotNL));
+
+ 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.vAttenuationDotNL[index] = 1.0 / (1.0 + unity_4LightAtten0[index] * poiLight.vDotNL[index]);
+ poiLight.vColor[index] = unity_LightColor[index].rgb;
+ poiLight.vHalfDir[index] = Unity_SafeNormalize(poiLight.vDirection[index] + poiCam.viewDir);
+ 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)
+ {
+ poiLight.directColor = _LightColor0.rgb;
+ poiLight.indirectColor = indirectColor;
+ }
+ else
+ {
+ poiLight.directColor = indirectColor * 0.6;
+ 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);
+ }
+
+ float lightMapMode = _LightingMapMode;
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 0)
+ {
+ poiLight.direction = _WorldSpaceLightPos0.xyz + unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
+ }
+ if (_LightingDirectionMode == 1 || _LightingDirectionMode == 2)
+ {
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 1)
+ {
+ poiLight.direction = mul(unity_ObjectToWorld, _LightngForcedDirection).xyz;;
+ }
+ //UNITY_BRANCH
+ if (_LightingDirectionMode == 2)
+ {
+ poiLight.direction = _LightngForcedDirection;
+ }
+ if (lightMapMode == 0)
+ {
+ 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 (!any(poiLight.direction))
+ {
+ poiLight.direction = float3(.4, 1, .4);
+ }
+
+ poiLight.direction = normalize(poiLight.direction);
+ poiLight.attenuationStrength = _LightingCastedShadows;
+ poiLight.attenuation = 1;
+ if (!all(_LightColor0.rgb == 0.0))
+ {
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.attenuation *= attenuation;
+ }
+
+ if (!any(poiLight.directColor) && !any(poiLight.indirectColor) && lightMapMode == 0)
+ {
+ lightMapMode = 1;
+ if (_LightingDirectionMode == 0)
+ {
+ 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);
+ poiLight.nDotLSaturated = saturate(poiLight.nDotL);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.vertexNDotV = abs(dot(poiMesh.normals[0], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ 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));
+ 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.detailShadow;
+ }
+ // Normalized nDotL
+ if (lightMapMode == 1)
+ {
+ poiLight.lightMap = poiLight.nDotLNormalized * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+ // Saturated nDotL
+ if (lightMapMode == 2)
+ {
+ poiLight.lightMap = poiLight.nDotLSaturated * lerp(1, poiLight.attenuation, poiLight.attenuationStrength);
+ }
+
+ poiLight.directColor = max(poiLight.directColor, 0.0001);
+ poiLight.indirectColor = max(poiLight.indirectColor, 0.0001);
+ poiLight.directColor = max(poiLight.directColor, poiLight.directColor / max(0.0001, (calculateluminance(poiLight.directColor) / _LightingMinLightBrightness)));
+ poiLight.indirectColor = max(poiLight.indirectColor, poiLight.indirectColor / max(0.0001, (calculateluminance(poiLight.indirectColor) / _LightingMinLightBrightness)));
+
+ 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);
+ //UNITY_BRANCH
+ if (_LightingCapEnabled)
+ {
+ poiLight.directColor = min(poiLight.directColor, _LightingCap);
+ poiLight.indirectColor = min(poiLight.indirectColor, _LightingCap);
+ }
+
+ //UNITY_BRANCH
+ 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 UNITY_PASS_FORWARDADD
+ #ifndef POI_LIGHT_DATA_ADDITIVE_ENABLE
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE) && defined(DIRECTIONAL)
+ return float4(mainTexture.rgb * .0001, 1);
+ #endif
+
+ #if defined(POINT) || defined(SPOT)
+ poiLight.direction = normalize(_WorldSpaceLightPos0.xyz - i.worldPos.xyz);
+
+ #ifdef POINT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord3 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1)).xyz;
+ poiLight.attenuation = tex2D(_LightTexture0, dot(lightCoord, lightCoord).rr).r;
+ #endif
+
+ #ifdef SPOT
+ poiLight.additiveShadow = UNITY_SHADOW_ATTENUATION(i, poiMesh.worldPos);
+ unityShadowCoord4 lightCoord = mul(unity_WorldToLight, unityShadowCoord4(poiMesh.worldPos, 1));
+ poiLight.attenuation = (lightCoord.z > 0) * UnitySpotCookie(lightCoord) * UnitySpotAttenuate(lightCoord.xyz);
+ #endif
+ #else
+ poiLight.direction = _WorldSpaceLightPos0.xyz;
+ UNITY_LIGHT_ATTENUATION(attenuation, i, poiMesh.worldPos)
+ poiLight.additiveShadow == 0;
+ poiLight.attenuation = attenuation;
+ #endif
+ poiLight.directColor = _LightingAdditiveLimited ? min(_LightingAdditiveLimit, _LightColor0.rgb) : _LightColor0.rgb;
+
+ #if defined(POINT_COOKIE) || defined(DIRECTIONAL_COOKIE)
+ poiLight.indirectColor = 0;
+ #else
+ poiLight.indirectColor = lerp(0, poiLight.directColor, _LightingAdditivePassthrough);
+ #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);
+ poiLight.nDotLNormalized = (poiLight.nDotL + 1) * 0.5;
+ poiLight.nDotV = abs(dot(poiMesh.normals[1], poiCam.viewDir));
+ poiLight.nDotH = dot(poiMesh.normals[1], poiLight.halfDir);
+ poiLight.lDotv = dot(poiLight.direction, poiCam.viewDir);
+ poiLight.lDotH = dot(poiLight.direction, poiLight.halfDir);
+ 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));
+ poiLight.lightMap = 1;
+ #endif
+
+ #ifdef POI_LIGHT_DATA_DEBUG
+
+ #ifdef UNITY_PASS_FORWARDBASE
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize <= 6)
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 0: // Direct Light Color
+ return float4(poiLight.directColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 1: // Indirect Light Color
+ return float4(poiLight.indirectColor + mainTexture.rgb * .0001, 1);
+ break;
+ case 2: // Light Map
+ return float4(poiLight.lightMap + mainTexture.rgb * .0001, 1);
+ break;
+ case 3: // Attenuation
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 4: // N Dot L
+ return float4(poiLight.nDotLNormalized, poiLight.nDotLNormalized, poiLight.nDotLNormalized, 1) + mainTexture * .0001;
+ break;
+ case 5:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ case 6:
+ return float4(poiLight.direction, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ else
+ {
+ return POI_SAFE_RGB1;
+ }
+ #endif
+ #ifdef UNITY_PASS_FORWARDADD
+ //UNITY_BRANCH
+ if (_LightingDebugVisualize < 6)
+ {
+ return POI_SAFE_RGB1;
+ }
+ else
+ {
+ switch(_LightingDebugVisualize)
+ {
+ case 7:
+ return float4(poiLight.directColor * poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 8:
+ return float4(poiLight.attenuation + mainTexture.rgb * .0001, 1);
+ break;
+ case 9:
+ return float4(poiLight.additiveShadow + mainTexture.rgb * .0001, 1);
+ break;
+ case 10:
+ return float4(poiLight.nDotLNormalized + mainTexture.rgb * .0001, 1);
+ break;
+ case 11:
+ return float4(poiLight.halfDir, 1) + mainTexture * .0001;
+ break;
+ }
+ }
+ #endif
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ #ifdef FINALPASS
+ ApplyDetailColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef VIGNETTE
+ calculateRGBMask(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #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
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #if defined(_LIGHTINGMODE_SHADEMAP) && defined(VIGNETTE_MASKED)
+ #ifndef POI_PASS_OUTLINE
+ #ifdef _LIGHTINGMODE_SHADEMAP
+ applyShadeMapping(poiFragData, poiMesh, poiLight);
+ #endif
+ #endif
+ #endif
+
+ #ifdef VIGNETTE_MASKED
+ #ifdef POI_PASS_OUTLINE
+ //UNITY_BRANCH
+ if (_OutlineLit)
+ {
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ }
+ else
+ {
+ poiLight.finalLighting = 1;
+ }
+ #else
+ calculateShading(poiLight, poiFragData, poiMesh, poiCam);
+ #endif
+ #else
+ poiLight.finalLighting = 1;
+ poiLight.rampedLightMap = aaBlurStep(poiLight.nDotL, 0.1, .1);
+ #endif
+
+ #ifdef POI_ANISOTROPICS
+ #ifdef POI_ANISOTROPICS_DEBUG
+ return float4(applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods), 1) + POI_SAFE_RGB1;
+ #else
+ applyAnisotropics(poiFragData, poiLight, poiCam, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #if defined(POI_MATCAP0) || defined(COLOR_GRADING_HDR_3D)
+ applyMatcap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef _CUBEMAP
+ applyCubemap(poiFragData, poiCam, poiMesh, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef _GLOSSYREFLECTIONS_OFF
+ ApplyRimLighting(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef _SUNDISK_SIMPLE
+ applyGlitter(poiFragData, poiMesh, poiCam, poiLight, poiMods);
+ #endif
+
+ #ifdef POI_STYLIZED_StylizedSpecular
+ stylizedSpecular(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_PATHING
+ // Only run pathing if a map exists.
+ #if defined(PROP_PATHINGMAP) || !defined(OPTIMIZER_ENABLED)
+ applyPathing(poiFragData, poiMesh, poiMods);
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ #ifdef POI_IRIDESCENCE
+ applyIridescence(poiFragData, poiMesh, poiCam, poiMods);
+ #endif
+
+ #ifdef EFFECT_BUMP
+ ApplyTextOverlayColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ if (_AlphaPremultiply)
+ {
+ poiFragData.baseColor *= saturate(poiFragData.alpha);
+ }
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ poiFragData.finalColor = poiFragData.baseColor * poiLight.finalLighting;
+
+ #ifdef MOCHIE_PBR
+ MochieBRDF(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+ #ifdef POI_CLEARCOAT
+ poiClearCoat(poiFragData, poiCam, poiLight, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_ENVIRORIM
+ applyEnvironmentRim(poiFragData, poiMesh, poiCam);
+ #endif
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ 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)));
+ }
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor * poiFragData.alpha, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ Pass
+ {
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Stencil
+ {
+ Ref [_StencilRef]
+ ReadMask [_StencilReadMask]
+ WriteMask [_StencilWriteMask]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ AlphaToMask Off
+ ZTest [_ZTest]
+ ColorMask [_ColorMask]
+ Offset [_OffsetFactor], [_OffsetUnits]
+
+ BlendOp [_BlendOp], [_BlendOpAlpha]
+ Blend [_SrcBlend] [_DstBlend]
+
+ CGPROGRAM
+ /*
+ // Disable warnings we aren't interested in
+ #if defined(UNITY_COMPILER_HLSL)
+ #pragma warning(disable : 3205) // conversion of larger type to smaller
+ #pragma warning(disable : 3568) // unknown pragma ignored
+ #pragma warning(disable : 3571) // "pow(f,e) will not work for negative f"; however in majority of our calls to pow we know f is not negative
+ #pragma warning(disable : 3206) // implicit truncation of vector type
+ #endif
+ */
+ #pragma target 5.0
+
+ #pragma skip_variants DYNAMICLIGHTMAP_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING DIRLIGHTMAP_COMBINED SHADOWS_SHADOWMASK
+
+ #pragma shader_feature_local POI_UDIMDISCARD
+
+ #pragma shader_feature USER_LUT
+
+ #pragma shader_feature_local POI_PARALLAX
+
+ #pragma shader_feature POI_AUDIOLINK
+
+ #pragma shader_feature_local POI_LIGHT_DATA_DEBUG
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_ENABLE
+ #pragma shader_feature_local POI_LIGHT_DATA_ADDITIVE_DIRECTIONAL_ENABLE
+ #pragma shader_feature_local POI_VERTEXLIGHT_ON
+
+ #pragma shader_feature COLOR_GRADING_HDR
+
+ //#pragma shader_feature KEYWORD
+
+ #pragma shader_feature FINALPASS
+
+ #pragma shader_feature AUTO_EXPOSURE
+
+ #pragma shader_feature_local POI_BACKFACE
+
+ #pragma shader_feature VIGNETTE
+ #pragma shader_feature GEOM_TYPE_MESH
+
+ #pragma shader_feature GEOM_TYPE_BRANCH
+ #pragma shader_feature GEOM_TYPE_BRANCH_DETAIL
+ #pragma shader_feature GEOM_TYPE_FROND
+ #pragma shader_feature DEPTH_OF_FIELD_COC_VIEW
+
+ #pragma shader_feature DISTORT
+
+ #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
+ #pragma shader_feature_local POI_CLOTHLERP
+
+ #pragma shader_feature_local POI_ANISOTROPICS
+ #pragma shader_feature_local POI_ANISOTROPICS_DEBUG
+
+ #pragma shader_feature COLOR_GRADING_HDR_3D
+ #pragma shader_feature_local POI_MATCAP0
+ #pragma shader_feature_local POI_MATCAP0_CUSTOM_NORMAL
+ #pragma shader_feature_local POI_MATCAP1_CUSTOM_NORMAL
+
+ #pragma shader_feature_local _CUBEMAP
+
+ #pragma shader_feature_local POI_AL_DECAL
+
+ #pragma shader_feature _SUNDISK_HIGH_QUALITY
+
+ #pragma shader_feature _EMISSION
+ #pragma shader_feature_local POI_EMISSION_1
+ #pragma shader_feature_local POI_EMISSION_2
+ #pragma shader_feature_local POI_EMISSION_3
+
+ #pragma shader_feature _GLOSSYREFLECTIONS_OFF
+ #pragma shader_feature_local _RIMSTYLE_POIYOMI _RIMSTYLE_UTS2
+
+ #pragma shader_feature _SUNDISK_SIMPLE
+
+ #pragma shader_feature_local MOCHIE_PBR
+ #pragma shader_feature_local POI_CLEARCOAT
+
+ #pragma shader_feature_local POI_ENVIRORIM
+
+ #pragma shader_feature_local POI_STYLIZED_StylizedSpecular
+
+ #pragma shader_feature_local POI_PATHING
+
+ #pragma shader_feature_local POI_MIRROR
+
+ #pragma shader_feature GRAIN
+
+ #pragma shader_feature_local POI_IRIDESCENCE
+
+ #pragma shader_feature EFFECT_BUMP
+
+ #pragma shader_feature_local POSTPROCESS
+
+ #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"
+ #include "AutoLight.cginc"
+ #include "UnityLightingCommon.cginc"
+ #include "UnityPBSLighting.cginc"
+ #ifdef POI_PASS_META
+ #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 POI2D_SAMPLER_PAN(tex, texSampler, uv, pan) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan))
+ #define POI2D_SAMPLER_PANGRAD(tex, texSampler, uv, pan, ddx, ddy) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv + _Time.x * pan, ddx, ddy))
+ #define POI2D_SAMPLER(tex, texSampler, uv) (UNITY_SAMPLE_TEX2D_SAMPLER(tex, texSampler, uv))
+ #define POI2D_PAN(tex, uv, pan) (tex2D(tex, uv + _Time.x * pan))
+ #define POI2D(tex, uv) (tex2D(tex, uv))
+ #define POI_SAMPLE_TEX2D(tex, uv) (UNITY_SAMPLE_TEX2D(tex, uv))
+ #define POI_SAMPLE_TEX2D_PAN(tex, uv, pan) (UNITY_SAMPLE_TEX2D(tex, uv + _Time.x * pan))
+
+ #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_MODE_OPAQUE 0
+ #define POI_MODE_CUTOUT 1
+ #define POI_MODE_FADE 2
+ #define POI_MODE_TRANSPARENT 3
+ #define POI_MODE_ADDITIVE 4
+ #define POI_MODE_SOFTADDITIVE 5
+ #define POI_MODE_MULTIPLICATIVE 6
+ #define POI_MODE_2XMULTIPLICATIVE 7
+ #define POI_MODE_TRANSCLIPPING 9
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+
+ [HideInInspector][ThryWideEnum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Panosphere, 4, World Pos XZ, 5, Polar UV, 6, Distorted UV, 7 )]
+ */
+ // Map of where features in AudioLink are.
+ #define ALPASS_DFT uint2(0,4) //Size: 128, 2
+ #define ALPASS_WAVEFORM uint2(0,6) //Size: 128, 16
+ #define ALPASS_AUDIOLINK uint2(0,0) //Size: 128, 4
+ #define ALPASS_AUDIOBASS uint2(0,0) //Size: 128, 1
+ #define ALPASS_AUDIOLOWMIDS uint2(0,1) //Size: 128, 1
+ #define ALPASS_AUDIOHIGHMIDS uint2(0,2) //Size: 128, 1
+ #define ALPASS_AUDIOTREBLE uint2(0,3) //Size: 128, 1
+ #define ALPASS_AUDIOLINKHISTORY uint2(1,0) //Size: 127, 4
+ #define ALPASS_GENERALVU uint2(0,22) //Size: 12, 1
+ #define ALPASS_CCINTERNAL uint2(12,22) //Size: 12, 2
+ #define ALPASS_CCCOLORS uint2(25,22) //Size: 11, 1
+ #define ALPASS_CCSTRIP uint2(0,24) //Size: 128, 1
+ #define ALPASS_CCLIGHTS uint2(0,25) //Size: 128, 2
+ #define ALPASS_AUTOCORRELATOR uint2(0,27) //Size: 128, 1
+ #define ALPASS_GENERALVU_INSTANCE_TIME uint2(2,22)
+ #define ALPASS_GENERALVU_LOCAL_TIME uint2(3,22)
+ #define ALPASS_GENERALVU_NETWORK_TIME uint2(4,22)
+ #define ALPASS_GENERALVU_PLAYERINFO uint2(6,22)
+ // Added in version 2.5
+ #define ALPASS_FILTEREDAUDIOLINK uint2(0,28) //Size: 16, 4
+ // Added in version 2.6
+ #define ALPASS_CHRONOTENSITY uint2(16,28) //Size: 8, 4
+ #define ALPASS_THEME_COLOR0 uint2(0,23)
+ #define ALPASS_THEME_COLOR1 uint2(1,23)
+ #define ALPASS_THEME_COLOR2 uint2(2,23)
+ #define ALPASS_THEME_COLOR3 uint2(3,23)
+ #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.
+ #define AUDIOLINK_SAMPLEDATA24 2046
+ #define AUDIOLINK_EXPBINS 24
+ #define AUDIOLINK_EXPOCT 10
+ #define AUDIOLINK_ETOTALBINS (AUDIOLINK_EXPBINS * AUDIOLINK_EXPOCT)
+ #define AUDIOLINK_WIDTH 128
+ #define AUDIOLINK_SPS 48000 // Samples per second
+ #define AUDIOLINK_ROOTNOTE 0
+ #define AUDIOLINK_4BAND_FREQFLOOR 0.123
+ #define AUDIOLINK_4BAND_FREQCEILING 1
+ #define AUDIOLINK_BOTTOM_FREQUENCY 13.75
+ #define AUDIOLINK_BASE_AMPLITUDE 2.5
+ #define AUDIOLINK_DELAY_COEFFICIENT_MIN 0.3
+ #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
+ #define COLORCHORD_IIR_DECAY_2 0.85
+ #define COLORCHORD_CONSTANT_DECAY_1 0.01
+ #define COLORCHORD_CONSTANT_DECAY_2 0.0
+ #define COLORCHORD_NOTE_CLOSEST 3.0
+ #define COLORCHORD_NEW_NOTE_GAIN 8.0
+ #define COLORCHORD_MAX_NOTES 10
+
+ // We use glsl_mod for most calculations because it behaves better
+ // on negative numbers, and in some situations actually outperforms
+ // HLSL's modf().
+ #ifndef glsl_mod
+ #define glsl_mod(x, y) (((x) - (y) * floor((x) / (y))))
+ #endif
+
+ 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;
+ #define AudioLinkData(xycoord) tex2Dlod(_AudioTexture, float4(uint2(xycoord) * _AudioTexture_TexelSize.xy, 0, 0))
+ #else
+ uniform Texture2D<float4> _AudioTexture;
+ SamplerState sampler_AudioTexture;
+ #define AudioLinkData(xycoord) _AudioTexture[uint2(xycoord)]
+ #endif
+
+ float _Mode;
+
+ #ifdef POI_UDIMDISCARD
+ float _UDIMDiscardMode;
+ float _UDIMDiscardUV;
+ float4 _UDIMDiscardRow3;
+ float4 _UDIMDiscardRow2;
+ float4 _UDIMDiscardRow1;
+ float4 _UDIMDiscardRow0;
+ #endif
+
+ #ifdef USER_LUT
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DistortionFlowTexture;
+ float4 _DistortionFlowTexture_ST;
+ 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;
+ float2 _DistortionMaskPan;
+ float _DistortionMaskUV;
+ #endif
+
+ float _DistortionUvToDistort;
+ float _DistortionStrength;
+ float _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ half _EnableDistortionAudioLink;
+ half2 _DistortionStrengthAudioLink;
+ half _DistortionStrengthAudioLinkBand;
+ half2 _DistortionStrength1AudioLink;
+ half _DistortionStrength1AudioLinkBand;
+ #endif
+ #endif
+ float _StereoEnabled;
+ float _PolarUV;
+ float2 _PolarCenter;
+ float _PolarRadialScale;
+ float _PolarLengthScale;
+ float _PolarSpiralPower;
+ float _PanoUseBothEyes;
+
+ #ifdef POI_PARALLAX
+
+ sampler2D _HeightMap;
+ float4 _HeightMap_ST;
+ float2 _HeightMapPan;
+ float _HeightMapUV;
+
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _Heightmask;
+ float4 _Heightmask_ST;
+ float2 _HeightmaskPan;
+ float _HeightmaskUV;
+ float _HeightmaskInvert;
+ SamplerState _linear_repeat;
+ #endif
+
+ float _ParallaxUV;
+ float _HeightStrength;
+ float _HeightOffset;
+ float _HeightStepsMin;
+ float _HeightStepsMax;
+
+ float _CurvatureU;
+ float _CurvatureV;
+ float _CurvFix;
+ /*
+ */
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ float _AudioLinkDelay;
+ float _AudioLinkAnimToggle;
+ float _DebugWaveform;
+ float _DebugDFT;
+ float _DebugBass;
+ float _DebugLowMids;
+ float _DebugHighMids;
+ float _DebugTreble;
+ float _DebugCCColors;
+ float _DebugCCStrip;
+ float _DebugCCLights;
+ float _DebugAutocorrelator;
+ float _DebugChronotensity;
+ float _AudioLinkCCStripY;
+ #endif
+
+ float _IgnoreFog;
+ float _RenderingReduceClipDistance;
+
+ float4 _Color;
+ float _ColorThemeIndex;
+ UNITY_DECLARE_TEX2D(_MainTex);
+ UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
+ float4 _MainTex_ST;
+ float2 _MainTexPan;
+ float _MainTexUV;
+ float4 _MainTex_TexelSize;
+ Texture2D _BumpMap;
+ float4 _BumpMap_ST;
+ float2 _BumpMapPan;
+ float _BumpMapUV;
+ float _BumpScale;
+ Texture2D _ClippingMask;
+ float4 _ClippingMask_ST;
+ float2 _ClippingMaskPan;
+ float _ClippingMaskUV;
+ float _Inverse_Clipping;
+ float _Cutoff;
+
+ float _MainColorAdjustToggle;
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MainColorAdjustTexture;
+ #endif
+ float4 _MainColorAdjustTexture_ST;
+ float2 _MainColorAdjustTexturePan;
+ float _MainColorAdjustTextureUV;
+ float _MainHueShiftToggle;
+ float _MainHueShiftReplace;
+ float _MainHueShift;
+ float _MainHueShiftSpeed;
+ float _Saturation;
+ float _MainBrightness;
+
+ float _MainHueALCTEnabled;
+ float _MainALHueShiftBand;
+ float _MainALHueShiftCTIndex;
+ float _MainHueALMotionSpeed;
+
+ SamplerState sampler_linear_clamp;
+ SamplerState sampler_linear_repeat;
+
+ float _AlphaForceOpaque;
+ float _AlphaMod;
+ float _AlphaPremultiply;
+
+ float _AlphaToCoverage;
+ float _AlphaSharpenedA2C;
+ float _AlphaMipScale;
+
+ float _AlphaDithering;
+ float _AlphaDitherGradient;
+
+ float _AlphaDistanceFade;
+ float _AlphaDistanceFadeType;
+ float _AlphaDistanceFadeMinAlpha;
+ float _AlphaDistanceFadeMaxAlpha;
+ float _AlphaDistanceFadeMin;
+ float _AlphaDistanceFadeMax;
+
+ float _AlphaFresnel;
+ float _AlphaFresnelAlpha;
+ float _AlphaFresnelSharpness;
+ float _AlphaFresnelWidth;
+ float _AlphaFresnelInvert;
+
+ float _AlphaAngular;
+ float _AngleType;
+ float _AngleCompareTo;
+ float3 _AngleForwardDirection;
+ float _CameraAngleMin;
+ float _CameraAngleMax;
+ float _ModelAngleMin;
+ float _ModelAngleMax;
+ float _AngleMinAlpha;
+
+ float _AlphaAudioLinkEnabled;
+ float2 _AlphaAudioLinkAddRange;
+ float _AlphaAudioLinkAddBand;
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef AUTO_EXPOSURE
+ float4 _VertexManipulationLocalTranslation;
+ float4 _VertexManipulationLocalRotation;
+ float3 _VertexManipulationLocalRotationSpeed;
+ float4 _VertexManipulationLocalScale;
+ float4 _VertexManipulationWorldTranslation;
+ float _VertexManipulationHeight;
+ sampler2D _VertexManipulationHeightMask;
+ float4 _VertexManipulationHeightMask_ST;
+ float2 _VertexManipulationHeightMaskPan;
+ float _VertexManipulationHeightMaskUV;
+ float _VertexManipulationHeightBias;
+ float _VertexRoundingEnabled;
+ float _VertexRoundingDivision;
+
+ //AL
+ float _VertexAudioLinkEnabled;
+ float3 _VertexLocalTranslationALMin;
+ float3 _VertexLocalTranslationALMax;
+ float _VertexLocalTranslationALBand;
+
+ float3 _VertexLocalRotationAL;
+ float _VertexLocalRotationALBand;
+
+ float3 _VertexLocalRotationCTALSpeed;
+ float _VertexLocalRotationCTALBandX;
+ float _VertexLocalRotationCTALBandY;
+ float _VertexLocalRotationCTALBandZ;
+ 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;
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ float _MainVertexColoringLinearSpace;
+ float _MainVertexColoring;
+ float _MainUseVertexColorAlpha;
+
+ #ifdef POI_BACKFACE
+ float _BackFaceEnabled;
+ float _BackFaceDetailIntensity;
+ float _BackFaceEmissionStrength;
+ float2 _BackFacePanning;
+ float4 _BackFaceColor;
+ float _BackFaceColorThemeIndex;
+ float _BackFaceReplaceAlpha;
+ float _BackFaceAlpha;
+
+ #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
+ float4 _BackFaceMask_ST;
+ float2 _BackFaceMaskPan;
+ float _BackFaceMaskUV;
+
+ float _BackFaceHueShiftEnabled;
+ float _BackFaceHueShift;
+ float _BackFaceHueShiftSpeed;
+ float _BackFaceEmissionLimiter;
+ #endif
+
+ //TODO detail strength stuff
+
+ #ifdef DISTORT
+ float _DissolveType;
+ float _DissolveEdgeWidth;
+ float4 _DissolveEdgeColor;
+ sampler2D _DissolveEdgeGradient;
+ float4 _DissolveEdgeGradient_ST;
+ float2 _DissolveEdgeGradientPan;
+ float _DissolveEdgeGradientUV;
+ float _DissolveEdgeEmission;
+ 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 _DissolveMaskInvert;
+ float _DissolveAlpha;
+ float _ContinuousDissolve;
+ float _DissolveDetailStrength;
+ float _DissolveEdgeHardness;
+ float _DissolveInvertNoise;
+ float _DissolveInvertDetailNoise;
+ float _DissolveToEmissionStrength;
+
+ // Point to Point
+ float _DissolveP2PWorldLocal;
+ float _DissolveP2PEdgeLength;
+ float4 _DissolveStartPoint;
+ float4 _DissolveEndPoint;
+
+ // World Dissolve
+ float _DissolveWorldShape;
+ float4 _DissolveShapePosition;
+ float4 _DissolveShapeRotation;
+ float _DissolveShapeScale;
+ float _DissolveInvertShape;
+ float _DissolveShapeEdgeLength;
+
+ float _DissolveAlpha0;
+ float _DissolveAlpha1;
+ float _DissolveAlpha2;
+ float _DissolveAlpha3;
+ float _DissolveAlpha4;
+ float _DissolveAlpha5;
+ float _DissolveAlpha6;
+ float _DissolveAlpha7;
+ float _DissolveAlpha8;
+ float _DissolveAlpha9;
+ // Masking
+ float _DissolveEmissionSide;
+ float _DissolveEmission1Side;
+ float _DissolveUseVertexColors;
+
+ float4 edgeColor;
+ float edgeAlpha;
+ float dissolveAlpha;
+ float4 dissolveToTexture;
+
+ float _DissolveHueShiftEnabled;
+ float _DissolveHueShiftSpeed;
+ float _DissolveHueShift;
+ float _DissolveEdgeHueShiftEnabled;
+ float _DissolveEdgeHueShiftSpeed;
+ float _DissolveEdgeHueShift;
+
+ // Audio Link
+ #ifdef POI_AUDIOLINK
+ fixed _EnableDissolveAudioLink;
+ half _AudioLinkDissolveAlphaBand;
+ float2 _AudioLinkDissolveAlpha;
+ half _AudioLinkDissolveDetailBand;
+ float2 _AudioLinkDissolveDetail;
+ #endif
+ #endif
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ float _ALDecalUV;
+ float4 _ALUVScale;
+ float2 _ALUVPosition;
+ 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;
+ float _ALDecalLineWidth;
+ float _ALDecalVolumeColorSource;
+ float3 _ALDecalVolumeColorLow;
+ float3 _ALDecalVolumeColorMid;
+ float3 _ALDecalVolumeColorHigh;
+ float _ALDecalLowEmission;
+ float _ALDecalMidEmission;
+ float _ALDecalHighEmission;
+ float _ALDecalBlendType;
+ float _ALDecalBlendAlpha;
+ float _ALDecalControlsAlpha;
+ #endif
+ #endif
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ UNITY_DECLARE_TEX2DARRAY(_FlipbookTexArray);
+ float4 _FlipbookTexArray_ST;
+
+ float4 _FlipbookColor;
+ float _FlipbookColorThemeIndex;
+ float _FlipbookFPS;
+ float _FlipbookTotalFrames;
+ float4 _FlipbookScaleOffset;
+ float4 _FlipbookSideOffset;
+ float _FlipbookTiled;
+ float _FlipbookManualFrameControl;
+ float _FlipbookCurrentFrame;
+ float _FlipbookEmissionStrength;
+ float _FlipbookRotation;
+ float _EnableFlipbook;
+ float _FlipbookTexArrayUV;
+ float _FlipbookAlphaControlsFinalAlpha;
+ float _FlipbookRotationSpeed;
+ float _FlipbookIntensityControlsAlpha;
+ float _FlipbookColorReplaces;
+ float2 _FlipbookTexArrayPan;
+
+ // blending
+ float _FlipbookReplace;
+ float _FlipbookMultiply;
+ float _FlipbookAdd;
+
+ #if defined(PROP_FLIPBOOKMASSK) || !defined(OPTIMIZED_ENABLED)
+ Texture2D _FlipbookMask;
+ #endif
+ float4 _FlipbookMask_ST;
+ float2 _FlipbookMaskPan;
+ float _FlipbookMaskUV;
+
+ // anim
+ float _FlipbookMovementType;
+ float4 _FlipbookStartEndOffset;
+ float _FlipbookMovementSpeed;
+
+ // Crossfade
+ float _FlipbookCrossfadeEnabled;
+ float2 _FlipbookCrossfadeRange;
+
+ // Hueshift
+ float _FlipbookHueShiftEnabled;
+ float _FlipbookHueShiftSpeed;
+ float _FlipbookHueShift;
+
+ #ifdef POI_AUDIOLINK
+ float _FlipbookChronotensityEnabled;
+ float _FlipbookChronotensityBand;
+ float _FlipbookChronotensitySpeed;
+ float _FlipbookChronoType;
+ half _AudioLinkFlipbookScaleBand;
+ half4 _AudioLinkFlipbookScale;
+ half _AudioLinkFlipbookAlphaBand;
+ half2 _AudioLinkFlipbookAlpha;
+ half _AudioLinkFlipbookEmissionBand;
+ half2 _AudioLinkFlipbookEmission;
+ half _AudioLinkFlipbookFrameBand;
+ half2 _AudioLinkFlipbookFrame;
+ #endif
+ #endif
+
+ #ifdef POI_MIRROR
+ float _Mirror;
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _MirrorTexture;
+ #endif
+ float4 _MirrorTexture_ST;
+ float2 _MirrorTexturePan;
+ float _MirrorTextureUV;
+ #endif
+
+ #if defined(PROP_DEPTHMASK) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthMask;
+ #endif
+ float4 _DepthMask_ST;
+ float2 _DepthMaskPan;
+ float _DepthMaskUV;
+
+ // Color
+ float _DepthColorToggle;
+ float _DepthColorBlendMode;
+ #if defined(PROP_DEPTHTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ Texture2D _DepthTexture;
+ #endif
+ float4 _DepthTexture_ST;
+ float2 _DepthTexturePan;
+ float _DepthTextureUV;
+
+ float3 _DepthColor;
+ float _DepthColorThemeIndex;
+ float _DepthColorMinDepth;
+ float _DepthColorMaxDepth;
+ float _DepthColorMinValue;
+ float _DepthColorMaxValue;
+ float _DepthEmissionStrength;
+
+ // Emission
+
+ // Alpha
+ float _DepthAlphaToggle;
+ float _DepthAlphaMinValue;
+ float _DepthAlphaMaxValue;
+ float _DepthAlphaMinDepth;
+ float _DepthAlphaMaxDepth;
+
+ /*
+ Texture2D ;
+ float4 _ST;
+ float2 Pan;
+ float UV;
+ */
+
+ //Future upgrade
+ /*
+ Texture _Tex;
+ Float _Thickness = 0.01;
+
+ 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,
+ 1,0,-1
+ };
+
+ float2 sobel = 0;
+ for (int i = 0; i<9; i++)
+ {
+ float depth = SAMPLE2D(Tex, sampler_Tex, UV+
+ sobelSamplePoints[i] * _Thickness);
+ sobel += depth * float2(sobelXMatrix[i], sobelYMatrix[i]);
+ }
+
+ Out = length(sobel);
+ */
+
+ //Structs
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float3 normal : NORMAL;
+ float4 tangent : TANGENT;
+ float4 color : COLOR;
+ float2 uv0 : TEXCOORD0;
+ float2 uv1 : TEXCOORD1;
+ float2 uv2 : TEXCOORD2;
+ float2 uv3 : TEXCOORD3;
+ uint vertexId : SV_VertexID;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f
+ {
+ float4 pos : SV_POSITION;
+ float2 uv[4] : TEXCOORD0;
+ float3 objNormal : TEXCOORD4;
+ float3 normal : TEXCOORD5;
+ float3 tangent : TEXCOORD6;
+ float3 binormal : TEXCOORD7;
+ float4 worldPos : TEXCOORD8;
+ float4 localPos : TEXCOORD9;
+ float3 objectPos : TEXCOORD10;
+ float4 vertexColor : TEXCOORD11;
+ float4 lightmapUV : TEXCOORD12;
+ float4 grabPos: TEXCOORD13;
+ float4 worldDirection: TEXCOORD14;
+ UNITY_SHADOW_COORDS(15)
+ UNITY_FOG_COORDS(16)
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ struct PoiMesh
+ {
+
+ // 0 Vertex normal
+ // 1 Fragment normal
+ float3 normals[2];
+ float3 objNormal;
+ float3 tangentSpaceNormal;
+ float3 binormal;
+ float3 tangent;
+ float3 worldPos;
+ float3 localPos;
+ float3 objectPosition;
+ float isFrontFace;
+ float4 vertexColor;
+ float4 lightmapUV;
+ // 0-3 UV0-UV3
+ // 4 Panosphere UV
+ // 5 world pos xz
+ // 6 Polar UV
+ // 7 Distorted UV
+ float2 uv[8];
+ float2 parallaxUV;
+ };
+
+ struct PoiCam
+ {
+ float3 viewDir;
+ float3 forwardDir;
+ float3 worldPos;
+ float distanceToVert;
+ float4 clipPos;
+ float3 reflectionDir;
+ float3 vertexReflectionDir;
+ float3 tangentViewDir;
+ float4 grabPos;
+ float2 screenUV;
+ float vDotN;
+ float4 worldDirection;
+
+ };
+
+ struct PoiMods
+ {
+ float4 Mask;
+ float4 audioLink;
+ float audioLinkAvailable;
+ float audioLinkVersion;
+ float4 audioLinkTexture;
+ float2 detailMask;
+ float2 backFaceDetailIntensity;
+ float globalEmission;
+ float4 globalColorTheme[12];
+ float ALTime[8];
+ };
+
+ struct PoiLight
+ {
+
+ float3 direction;
+ float attenuation;
+ float attenuationStrength;
+ float3 directColor;
+ float3 indirectColor;
+ float occlusion;
+ float shadowMask;
+ float detailShadow;
+ float3 halfDir;
+ float lightMap;
+ float3 rampedLightMap;
+ float vertexNDotL;
+ float nDotL;
+ float nDotV;
+ float vertexNDotV;
+ float nDotH;
+ float vertexNDotH;
+ float lDotv;
+ float lDotH;
+ float nDotLSaturated;
+ float nDotLNormalized;
+ #ifdef UNITY_PASS_FORWARDADD
+ float additiveShadow;
+ #endif
+ float3 finalLighting;
+ float3 finalLightAdd;
+
+ #if defined(VERTEXLIGHT_ON) && defined(POI_VERTEXLIGHT_ON)
+ // Non Important Lights
+ float4 vDotNL;
+ float4 vertexVDotNL;
+ float3 vColor[4];
+ float4 vCorrectedDotNL;
+ float4 vAttenuation;
+ float4 vAttenuationDotNL;
+ float3 vPosition[4];
+ float3 vDirection[4];
+ float3 vFinalLighting;
+ float3 vHalfDir[4];
+ half4 vDotNH;
+ half4 vertexVDotNH;
+ half4 vDotLH;
+ #endif
+
+ };
+
+ struct PoiVertexLights
+ {
+
+ float3 direction;
+ float3 color;
+ float attenuation;
+ };
+
+ struct PoiFragData
+ {
+ float3 baseColor;
+ float3 finalColor;
+ float alpha;
+ float3 emission;
+ };
+
+ float2 poiUV(float2 uv, float4 tex_st)
+ {
+ return uv * tex_st.xy + tex_st.zw;
+ }
+
+ //Lighting Helpers
+ float calculateluminance(float3 color)
+ {
+ return color.r * 0.299 + color.g * 0.587 + color.b * 0.114;
+ }
+
+ 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;
+ }
+
+ /*
+ * MIT License
+ *
+ * Copyright (c) 2018 s-ilent
+ *
+ * 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
+ * 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.
+ */
+
+ 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;
+ float3 L0 = float3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w) + float3(unity_SHBr.z, unity_SHBg.z, unity_SHBb.z) / 3.0;
+ indirect.r = shEvaluateDiffuseL1Geomerics_local(L0.r, unity_SHAr.xyz, normal.xyz);
+ indirect.g = shEvaluateDiffuseL1Geomerics_local(L0.g, unity_SHAg.xyz, normal.xyz);
+ indirect.b = shEvaluateDiffuseL1Geomerics_local(L0.b, unity_SHAb.xyz, normal.xyz);
+ indirect = max(0, indirect);
+ indirect += SHEvalLinearL2(normal);
+ return indirect;
+ }
+
+ // Silent's code ends here
+
+ float3 getCameraForward()
+ {
+ #if UNITY_SINGLE_PASS_STEREO
+ float3 p1 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 1, 1));
+ float3 p2 = mul(unity_StereoCameraToWorld[0], float4(0, 0, 0, 1));
+ #else
+ float3 p1 = mul(unity_CameraToWorld, float4(0, 0, 1, 1)).xyz;
+ float3 p2 = mul(unity_CameraToWorld, float4(0, 0, 0, 1)).xyz;
+ #endif
+ return normalize(p2 - p1);
+ }
+
+ half3 GetSHLength()
+ {
+ half3 x, x1;
+ x.r = length(unity_SHAr);
+ x.g = length(unity_SHAg);
+ x.b = length(unity_SHAb);
+ x1.r = length(unity_SHBr);
+ x1.g = length(unity_SHBg);
+ 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
+ //UNITY_BRANCH
+ if (cubemapPosition.w > 0)
+ {
+ float3 factors = ((direction > 0 ? boxMax : boxMin) - position) / direction;
+ float scalar = min(min(factors.x, factors.y), factors.z);
+ direction = direction * scalar + (position - cubemapPosition.xyz);
+ }
+ #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);
+ return normalize(
+ normal.x * poiMesh.tangent +
+ normal.y * poiMesh.binormal +
+ 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);
+ }
+ float2 calcParallax(in float height, in PoiCam poiCam)
+ {
+ 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),
+ 2: DstColor destinationColor,
+ 3: SrcColor sourceColor,
+ 4: OneMinusDstColor float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ 5: SrcAlpha sourceColor.aaaa,
+ 6: OneMinusSrcColor float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ 7: DstAlpha destinationColor.aaaa,
+ 8: OneMinusDstAlpha float4(1.0, 1.0, 1.0, 1.0) - destinationColor.,
+ 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;
+ const float4 blendData[11] = {
+ float4(0.0, 0.0, 0.0, 0.0),
+ float4(1.0, 1.0, 1.0, 1.0),
+ destinationColor,
+ sourceColor,
+ float4(1.0, 1.0, 1.0, 1.0) - destinationColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sourceColor,
+ sA,
+ float4(1.0, 1.0, 1.0, 1.0) - sA,
+ saturate(sourceColor.aaaa),
+ 1 - sA,
+ };
+
+ return lerp(blendData[sourceFactor] * sourceColor + blendData[destinationFactor] * destinationColor, sourceColor, sA);
+ }
+
+ // Average
+ float3 blendAverage(float3 base, float3 blend)
+ {
+ return (base + blend) / 2.0;
+ }
+
+ // Color burn
+ float blendColorBurn(float base, float blend)
+ {
+ return (blend == 0.0)?blend : max((1.0 - ((1.0 - base) / 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
+ float3 blendExclusion(float3 base, float3 blend)
+ {
+ 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
+ float3 blendGlow(float3 base, float3 blend)
+ {
+ 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
+ float3 blendHardLight(float3 base, float3 blend)
+ {
+ 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 min(base + blend, float3(1.0, 1.0, 1.0));
+ }
+
+ // 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
+ float3 blendMultiply(float3 base, float3 blend)
+ {
+ return base * blend;
+ }
+
+ // Negation
+ float3 blendNegation(float3 base, float3 blend)
+ {
+ return float3(1.0, 1.0, 1.0) - abs(float3(1.0, 1.0, 1.0) - base - blend);
+ }
+
+ // Normal
+ float3 blendNormal(float3 base, float3 blend)
+ {
+ return blend;
+ }
+
+ // Phoenix
+ float3 blendPhoenix(float3 base, float3 blend)
+ {
+ 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);
+ }
+
+ float3 customBlend(float3 base, float3 blend, float blendType)
+ {
+ float3 ret = 0;
+ switch(blendType)
+ {
+ case 0:
+ {
+ ret = blendNormal(base, blend);
+ break;
+ }
+ case 1:
+ {
+ ret = blendDarken(base, blend);
+ break;
+ }
+ case 2:
+ {
+ ret = blendMultiply(base, blend);
+ break;
+ }
+ case 3:
+ {
+ ret = blendColorBurn(base, blend);
+ break;
+ }
+ case 4:
+ {
+ ret = blendLinearBurn(base, blend);
+ break;
+ }
+ case 5:
+ {
+ ret = blendLighten(base, blend);
+ break;
+ }
+ case 6:
+ {
+ ret = blendScreen(base, blend);
+ break;
+ }
+ case 7:
+ {
+ ret = blendColorDodge(base, blend);
+ break;
+ }
+ case 8:
+ {
+ ret = blendLinearDodge(base, blend);
+ break;
+ }
+ case 9:
+ {
+ ret = blendOverlay(base, blend);
+ break;
+ }
+ case 10:
+ {
+ ret = blendSoftLight(base, blend);
+ break;
+ }
+ case 11:
+ {
+ ret = blendHardLight(base, blend);
+ break;
+ }
+ case 12:
+ {
+ ret = blendVividLight(base, blend);
+ break;
+ }
+ case 13:
+ {
+ ret = blendLinearLight(base, blend);
+ break;
+ }
+ case 14:
+ {
+ ret = blendPinLight(base, blend);
+ break;
+ }
+ case 15:
+ {
+ ret = blendHardMix(base, blend);
+ break;
+ }
+ case 16:
+ {
+ ret = blendDifference(base, blend);
+ break;
+ }
+ case 17:
+ {
+ ret = blendExclusion(base, blend);
+ break;
+ }
+ case 18:
+ {
+ ret = blendSubtract(base, blend);
+ break;
+ }
+ case 19:
+ {
+ ret = blendDivide(base, blend);
+ break;
+ }
+ }
+ return ret;
+ }
+
+ 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(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(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed), float2(12.9898, 78.233))) * 43758.5453)
+ ) * .5) * (maximum);
+ }
+
+ float3 randomFloat3Range(float2 Seed, float Range)
+ {
+ return (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ 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)
+ {
+ float3 rando = (float3(
+ frac(sin(dot(Seed.xy, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(Seed.yx, float2(12.9898, 78.233))) * 43758.5453),
+ frac(sin(dot(float2(Seed.x * Seed.y, Seed.y + Seed.x), float2(12.9898, 78.233))) * 43758.5453)
+ ) * 2 - 1);
+ float speed = 1 + wiggleSpeed;
+ return float3(sin((_Time.x + rando.x * PI) * speed), sin((_Time.x + rando.y * PI) * speed), sin((_Time.x + rando.z * PI) * speed)) * Range;
+ }
+
+ void Unity_RandomRange_float(float2 Seed, float Min, float Max, out float Out)
+ {
+ float randomno = frac(sin(dot(Seed, float2(12.9898, 78.233))) * 43758.5453);
+ Out = lerp(Min, Max, randomno);
+ }
+
+ //art
+
+ // Based on unity shader graph code
+
+ // * Adjustments * //
+
+ /*
+ * Channel Mixer
+ *
+ * Controls the amount each of the channels of input In contribute to each of the channels of output Out. The slider
+ * parameters on the node control the contribution of each of the input channels. The toggle button parameters control
+ * which of the output channels is currently being edited. Slider controls for editing the contribution of each input
+ * channnel range between -2 and 2.
+ */
+ void poiChannelMixer(float3 In, float3 _ChannelMixer_Red, float3 _ChannelMixer_Green, float3 _ChannelMixer_Blue, out float3 Out)
+ {
+ Out = float3(dot(In, _ChannelMixer_Red), dot(In, _ChannelMixer_Green), dot(In, _ChannelMixer_Blue));
+ }
+
+ /*
+ * Contrast
+ *
+ * Adjusts the contrast of input In by the amount of input Contrast. A Contrast value of 1 will return the input
+ * unaltered. A Contrast value of 0 will return the midpoint of the input
+ */
+ void poiContrast(float3 In, float Contrast, out float3 Out)
+ {
+ float midpoint = pow(0.5, 2.2);
+ Out = (In - midpoint) * Contrast + midpoint;
+ }
+
+ /*
+ * Invert Colors
+ *
+ * Inverts the colors of input In on a per channel basis. This Node assumes all input values are in the range 0 - 1.
+ */
+ void poiInvertColors(float4 In, float4 InvertColors, out float4 Out)
+ {
+ Out = abs(InvertColors - In);
+ }
+
+ /*
+ * Replace Color
+ *
+ * Replaces values in input In equal to input From to the value of input To. Input Range can be used to define a
+ * wider range of values around input From to replace. Input Fuzziness can be used to soften the edges around the
+ * selection similar to anti-aliasing.
+ */
+ void poiReplaceColor(float3 In, float3 From, float3 To, float Range, float Fuzziness, out float3 Out)
+ {
+ float Distance = distance(From, In);
+ Out = lerp(To, In, saturate((Distance - Range) / max(Fuzziness, 0.00001)));
+ }
+
+ /*
+ * Saturation
+ *
+ * Adjusts the saturation of input In by the amount of input Saturation. A Saturation value of 1 will return the input
+ * unaltered. A Saturation value of 0 will return the input completely desaturated.
+ */
+ void poiSaturation(float3 In, float Saturation, out float3 Out)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ Out = luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+
+ /*
+ * Dither Node
+ *
+ * Dither is an intentional form of noise used to randomize quantization error. It is used to prevent large-scale
+ * patterns such as color banding in images. The Dither node applies dithering in screen-space to ensure a uniform
+ * distribution of the pattern. This can be adjusted by connecting another node to input Screen Position.
+ *
+ * This Node is commonly used as an input to Alpha Clip Threshold on a Master Node to give the appearance of
+ * transparency to an opaque object. This is useful for creating objects that appear to be transparent but have
+ * the advantages of rendering as opaque, such as writing depth and/or being rendered in deferred.
+ */
+ void poiDither(float4 In, float4 ScreenPosition, out float4 Out)
+ {
+ float2 uv = ScreenPosition.xy * _ScreenParams.xy;
+ float DITHER_THRESHOLDS[16] = {
+ 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,
+ 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,
+ 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,
+ 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0
+ };
+ uint index = (uint(uv.x) % 4) * 4 + uint(uv.y) % 4;
+ Out = In - DITHER_THRESHOLDS[index];
+ }
+
+ /*
+ * Color Mask
+ *
+ * Creates a mask from values in input In equal to input Mask Color. Input Range can be used to define a wider
+ * range of values around input Mask Color to create the mask. Colors within this range will return 1,
+ * otherwise the node will return 0. Input Fuzziness can be used to soften the edges around the selection
+ * similar to anti-aliasing.
+ */
+ void poiColorMask(float3 In, float3 MaskColor, float Range, float Fuzziness, out float4 Out)
+ {
+ float Distance = distance(MaskColor, In);
+ Out = saturate(1 - (Distance - Range) / max(Fuzziness, 0.00001));
+ }
+
+ static const float Epsilon = 1e-10;
+ // The weights of RGB contributions to luminance.
+ // Should sum to unity.
+ static const float3 HCYwts = float3(0.299, 0.587, 0.114);
+ static const float HCLgamma = 3;
+ static const float HCLy0 = 100;
+ 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;
+ float G = 2 - abs(H * 6 - 2);
+ 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
+ float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0 / 3.0) : float4(RGB.gb, 0.0, -1.0 / 3.0);
+ float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
+ float C = Q.x - min(Q.w, Q.y);
+ 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(in float3 RGB)
+ {
+ float3 HCV = RGBtoHCV(RGB);
+ float S = HCV.y / (HCV.z + Epsilon);
+ return float3(HCV.x, S, HCV.z);
+ }
+
+ 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);
+ float L = HCV.z - HCV.y * 0.5;
+ float S = HCV.y / (1 - abs(L * 2 - 1) + Epsilon);
+ return float3(HCV.x, S, L);
+ }
+
+ float3 hueShift(float3 color, float hueOffset)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ return HSVtoRGB(color);
+ }
+
+ float3 hueShiftClamped(float3 color, float hueOffset, float saturationOffset = 0, float valueOffset = 0)
+ {
+ color = RGBtoHSV(color);
+ color.x = frac(hueOffset +color.x);
+ color.y = saturate(saturationOffset +color.y);
+ color.z = saturate(valueOffset +color.z);
+ return HSVtoRGB(color);
+ }
+
+ //HSL MODIFT
+ float3 ModifyViaHSL(float3 color, float3 HSLMod)
+ {
+ float3 colorHSL = RGBtoHSL(color);
+ colorHSL.r = frac(colorHSL.r + HSLMod.r);
+ colorHSL.g = saturate(colorHSL.g + HSLMod.g);
+ colorHSL.b = saturate(colorHSL.b + HSLMod.b);
+ return HSLtoRGB(colorHSL);
+ }
+
+ float3 poiSaturation(float3 In, float Saturation)
+ {
+ float luma = dot(In, float3(0.2126729, 0.7151522, 0.0721750));
+ return luma.xxx + Saturation.xxx * (In - luma.xxx);
+ }
+ // LCH
+ float xyzF(float t)
+ {
+ return lerp(pow(t, 1. / 3.), 7.787037 * t + 0.139731, step(t, 0.00885645));
+ }
+ float xyzR(float t)
+ {
+ return lerp(t * t * t, 0.1284185 * (t - 0.139731), step(t, 0.20689655));
+ }
+ float3 rgb2lch(in float3 c)
+ {
+ c = mul(float3x3(0.4124, 0.3576, 0.1805,
+ 0.2126, 0.7152, 0.0722,
+ 0.0193, 0.1192, 0.9505), c);
+ c.x = xyzF(c.x / wref.x);
+ c.y = xyzF(c.y / wref.y);
+ c.z = xyzF(c.z / wref.z);
+ float3 lab = float3(max(0., 116.0 * c.y - 16.0), 500.0 * (c.x - c.y), 200.0 * (c.y - c.z));
+ return float3(lab.x, length(float2(lab.y, lab.z)), atan2(lab.z, lab.y));
+ }
+
+ float3 lch2rgb(in float3 c)
+ {
+ c = float3(c.x, cos(c.z) * c.y, sin(c.z) * c.y);
+
+ float lg = 1. / 116. * (c.x + 16.);
+ float3 xyz = float3(wref.x * xyzR(lg + 0.002 * c.y),
+ wref.y * xyzR(lg),
+ wref.z * xyzR(lg - 0.005 * c.z));
+
+ float3 rgb = mul(float3x3(3.2406, -1.5372, -0.4986,
+ - 0.9689, 1.8758, 0.0415,
+ 0.0557, -0.2040, 1.0570), xyz);
+
+ return rgb;
+ }
+
+ //cheaply lerp around a circle
+ float lerpAng(in float a, in float b, in float x)
+ {
+ float ang = fmod(fmod((a - b), TAU) + PI * 3., TAU) - PI;
+ return ang * x + b;
+ }
+
+ //Linear interpolation between two colors in Lch space
+ float3 lerpLch(in float3 a, in float3 b, in float x)
+ {
+ float hue = lerpAng(a.z, b.z, x);
+ return float3(lerp(b.xy, a.xy, x), hue);
+ }
+
+ float3 poiExpensiveColorBlend(float3 col1, float3 col2, float alpha)
+ {
+ return lch2rgb(lerpLch(rgb2lch(col1), rgb2lch(col2), alpha));
+ }
+
+ float4x4 poiAngleAxisRotationMatrix(float angle, float3 axis)
+ {
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return float4x4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+ }
+
+ float4x4 poiRotationMatrixFromAngles(float x, float y, float z)
+ {
+ float angleX = radians(x);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ 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);
+ float c = cos(angleX);
+ float s = sin(angleX);
+ float4x4 rotateXMatrix = float4x4(1, 0, 0, 0,
+ 0, c, -s, 0,
+ 0, s, c, 0,
+ 0, 0, 0, 1);
+
+ float angleY = radians(angles.y);
+ c = cos(angleY);
+ s = sin(angleY);
+ float4x4 rotateYMatrix = float4x4(c, 0, s, 0,
+ 0, 1, 0, 0,
+ - s, 0, c, 0,
+ 0, 0, 0, 1);
+
+ float angleZ = radians(angles.z);
+ c = cos(angleZ);
+ s = sin(angleZ);
+ float4x4 rotateZMatrix = float4x4(c, -s, 0, 0,
+ s, c, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1);
+
+ return mul(mul(rotateXMatrix, rotateYMatrix), rotateZMatrix);
+ }
+
+ float3 getCameraPosition()
+ {
+ #ifdef USING_STEREO_MATRICES
+ return lerp(unity_StereoWorldSpaceCameraPos[0], unity_StereoWorldSpaceCameraPos[1], 0.5);
+ #endif
+ return _WorldSpaceCameraPos;
+ }
+
+ half2 calcScreenUVs(half4 grabPos)
+ {
+ half2 uv = grabPos.xy / (grabPos.w + 0.0000000001);
+ #if UNITY_SINGLE_PASS_STEREO
+ uv.xy *= half2(_ScreenParams.x * 2, _ScreenParams.y);
+ #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
+ 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.
+
+ 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)
+ {
+ float sn = sin(angle * 0.5);
+ 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;
+ }
+
+ /*
+ MIT END
+ */
+
+ float aaBlurStep(float gradient, float edge, float blur)
+ {
+ float edgeMin = saturate(edge);
+ float edgeMax = saturate(edge + blur * (1 - edge));
+ return smoothstep(0, 1, saturate((gradient - edgeMin) / saturate(edgeMax - edgeMin + fwidth(gradient))));
+ }
+
+ float3 poiThemeColor(in PoiMods poiMods, in float3 srcColor, in float themeIndex)
+ {
+ if (themeIndex == 0) return srcColor;
+ themeIndex -= 1;
+
+ if (themeIndex <= 3)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ return poiMods.globalColorTheme[themeIndex];
+ }
+ #endif
+
+ return srcColor;
+ }
+
+ 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 lilTooningNoSaturate(float value, float border)
+ {
+ return (value - border) / clamp(fwidth(value), 0.0001, 1.0);
+ }
+
+ float lilTooningNoSaturate(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 lilTooningNoSaturate(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 lilTooning(float value, float border)
+ {
+ return saturate(lilTooningNoSaturate(value, border));
+ }
+
+ float lilTooning(float value, float border, float blur)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur));
+ }
+
+ float lilTooning(float value, float border, float blur, float borderRange)
+ {
+ return saturate(lilTooningNoSaturate(value, border, blur, borderRange));
+ }
+
+ 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);
+ }
+ #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()
+ {
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ int width, height;
+ _AudioTexture.GetDimensions(width, height);
+ return width > 16;
+ #else
+ return _AudioTexture_TexelSize.z > 16;
+ #endif
+ }
+
+ //Get version of audiolink present in the world, 0 if no audiolink is present
+ float AudioLinkGetVersion()
+ {
+ int2 dims;
+ #if !defined(AUDIOLINK_STANDARD_INDEXING)
+ _AudioTexture.GetDimensions(dims.x, dims.y);
+ #else
+ dims = _AudioTexture_TexelSize.zw;
+ #endif
+
+ if (dims.x >= 128)
+ return AudioLinkData(ALPASS_GENERALVU).x;
+ else if (dims.x > 16)
+ return 1;
+ 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)
+ {
+ uint time = AudioLinkDecodeDataAsUInt(indexloc) & 0x7ffffff;
+ //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;
+ float C = HSV.z * HSV.y;
+ float H = HSV.x * 6;
+ float X = C * (1 - abs(fmod(H, 2) - 1));
+ if (HSV.y != 0)
+ {
+ float I = floor(H);
+ if (I == 0) { RGB = float3(C, X, 0); }
+ else if (I == 1) { RGB = float3(X, C, 0); }
+ else if (I == 2) { RGB = float3(0, C, X); }
+ else if (I == 3) { RGB = float3(0, X, C); }
+ else if (I == 4) { RGB = float3(X, 0, C); }
+ else { RGB = float3(C, 0, X); }
+ }
+ 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);
+ {
+ if(note < 4.0)
+ {
+ //Needs to be YELLOW->RED
+ hue = (note) / 24.0;
+ }
+ else if(note < 8.0)
+ {
+ // [4] [8]
+ //Needs to be RED->BLUE
+ hue = (note-2.0) / 12.0;
+ }
+ else
+ {
+ // [8] [12]
+ //Needs to be BLUE->YELLOW
+ hue = (note - 4.0) / 8.0;
+ }
+ }
+ 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)
+ return fixed3(1.0, 1.0, 1.0);
+ else
+ return c / max(c.r, max(c.g, c.b));
+ }
+
+ void initPoiAudioLink(inout PoiMods poiMods)
+ {
+ poiMods.audioLinkAvailable = AudioLinkIsAvailable();
+ poiMods.audioLinkAvailable *= _AudioLinkAnimToggle;
+
+ if (poiMods.audioLinkAvailable)
+ {
+ poiMods.audioLinkVersion = AudioLinkGetVersion();
+ poiMods.audioLink.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ poiMods.audioLink.y = AudioLinkData(ALPASS_AUDIOLOWMIDS).r;
+ poiMods.audioLink.z = AudioLinkData(ALPASS_AUDIOHIGHMIDS).r;
+ poiMods.audioLink.w = AudioLinkData(ALPASS_AUDIOTREBLE).r;
+
+ /*
+ poiMods.globalColorTheme[4] = AudioLinkData( ALPASS_CCCOLORS + uint2( 0, 0 ) );
+ 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)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[5] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(3, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[6] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(4, 0)).x, AUDIOLINK_EXPBINS), 1, AUDIOLINK_ROOTNOTE), 1.0);
+ poiMods.globalColorTheme[7] = float4(AudioLinkCCtoRGB(glsl_mod(AudioLinkData(ALPASS_CCINTERNAL + uint2(5, 0)).x, 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);
+ }
+ }
+
+ void DebugVisualizer(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods){
+ if (_DebugWaveform){
+ float waveform = AudioLinkLerpMultiline(ALPASS_WAVEFORM + float2( 500. * poiMesh.uv[0].x, 0)).r;
+ poiFragData.emission += clamp(1 - 50 * abs(waveform - poiMesh.uv[0].y * 2. + 1), 0, 1);
+ }
+ if (_DebugDFT){
+ poiFragData.emission += AudioLinkLerpMultiline(ALPASS_DFT + uint2(poiMesh.uv[0].x * AUDIOLINK_ETOTALBINS, 0)).rrr;
+ }
+ if (_DebugBass){
+ poiFragData.emission += poiMods.audioLink.x;
+ }
+ if (_DebugLowMids){
+ poiFragData.emission += poiMods.audioLink.y;
+ }
+ if (_DebugHighMids){
+ poiFragData.emission += poiMods.audioLink.z;
+ }
+ if (_DebugTreble){
+ poiFragData.emission += poiMods.audioLink.w;
+ }
+ if (_DebugCCColors){
+ poiFragData.emission += AudioLinkData(ALPASS_CCCOLORS + uint2(3 + 1, 0));
+ }
+ if (_DebugCCStrip){
+ poiFragData.emission += AudioLinkLerp(ALPASS_CCSTRIP + float2(poiMesh.uv[0].x * AUDIOLINK_WIDTH, 0));
+ }
+ if (_DebugCCLights){
+ poiFragData.emission += AudioLinkData(ALPASS_CCLIGHTS + uint2(uint(poiMesh.uv[0].x * 8) + uint(poiMesh.uv[0].y * 16) * 8, 0));
+ }
+ if (_DebugAutocorrelator){
+ poiFragData.emission += saturate(AudioLinkLerp(ALPASS_AUTOCORRELATOR + float2((abs(1. - poiMesh.uv[0].x * 2.)) * AUDIOLINK_WIDTH, 0)).rrr);
+ }
+ if (_DebugChronotensity){
+ 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
+
+ v2f vert(appdata v)
+ {
+ UNITY_SETUP_INSTANCE_ID(v);
+ v2f o;
+ PoiInitStruct(v2f, o);
+ UNITY_TRANSFER_INSTANCE_ID(v, o);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+
+ #ifdef POI_UDIMDISCARD
+ UNITY_BRANCH
+ if(_UDIMDiscardMode == 0) // Discard Vertices instead of just pixels
+ {
+ // Branchless (inspired by s-ilent)
+ float2 udim = 0;
+ // Select UV
+ udim += (v.uv0.xy * (_UDIMDiscardUV == 0));
+ udim += (v.uv1.xy * (_UDIMDiscardUV == 1));
+ udim += (v.uv2.xy * (_UDIMDiscardUV == 2));
+ udim += (v.uv3.xy * (_UDIMDiscardUV == 3));
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) v.vertex = 0.0/0.0; // NaN position to discard; GPU discards degenerate geometry. thanks bgolus
+ }
+ #endif
+
+ #ifdef AUTO_EXPOSURE
+ float4 audioLinkBands = 0;
+ float3 ALrotation = 0;
+ float3 ALLocalTranslation = 0;
+ float3 CTALRotation = 0;
+ float3 ALScale = 0;
+ float3 ALWorldTranslation = 0;
+ float ALHeight = 0;
+ float ALRoundingAmount = 0;
+ #ifdef POI_AUDIOLINK
+ if (AudioLinkIsAvailable() && _VertexAudioLinkEnabled)
+ {
+ audioLinkBands.x = AudioLinkData(ALPASS_AUDIOBASS).r;
+ 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]);
+ }
+ if(any(_VertexLocalRotationAL))
+ {
+ ALrotation = audioLinkBands[_VertexLocalRotationALBand] * _VertexLocalRotationAL;
+ }
+ if(any(_VertexLocalRotationCTALSpeed))
+ {
+ CTALRotation.x = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeX, _VertexLocalRotationCTALBandX) * _VertexLocalRotationCTALSpeed.x * 360;
+ CTALRotation.y = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeY, _VertexLocalRotationCTALBandY) * _VertexLocalRotationCTALSpeed.y * 360;
+ CTALRotation.z = AudioLinkGetChronoTime(_VertexLocalRotationCTALTypeZ, _VertexLocalRotationCTALBandZ) * _VertexLocalRotationCTALSpeed.z * 360;
+ }
+ if(any(_VertexLocalScaleALMin) || any(_VertexLocalScaleALMax))
+ {
+ ALScale = lerp(_VertexLocalScaleALMin.xyz + _VertexLocalScaleALMin.w, _VertexLocalScaleALMax.xyz + _VertexLocalScaleALMax.w, audioLinkBands[_VertexLocalScaleALBand]);
+ }
+ if(any(_VertexWorldTranslationALMin) || any(_VertexWorldTranslationALMax))
+ {
+ ALWorldTranslation = lerp(_VertexWorldTranslationALMin, _VertexWorldTranslationALMax, audioLinkBands[_VertexWorldTranslationALBand]);
+ }
+ if(any(_VertexManipulationHeightAL))
+ {
+ ALHeight = lerp(_VertexManipulationHeightAL.x , _VertexManipulationHeightAL.y, audioLinkBands[_VertexManipulationHeightBand]);
+ }
+ if(any(_VertexRoundingRangeAL))
+ {
+ ALRoundingAmount = lerp(_VertexRoundingRangeAL.x, _VertexRoundingRangeAL.y, audioLinkBands[_VertexRoundingRangeBand]);
+ }
+ }
+ #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), rotation, _VertexManipulationLocalScale + float4(ALScale,0));
+ o.normal = UnityObjectToWorldNormal(v.normal);
+
+ #if defined(PROP_VERTEXMANIPULATIONHEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float3 heightOffset = (tex2Dlod(_VertexManipulationHeightMask, float4(poiUV(v.uv0, _VertexManipulationHeightMask_ST) + _VertexManipulationHeightMaskPan * _Time.x, 0, 0)).r - _VertexManipulationHeightBias) * (_VertexManipulationHeight + ALHeight) * o.normal;
+ #else
+ float3 heightOffset = (_VertexManipulationHeight + ALHeight) * o.normal;
+ #endif
+
+ v.vertex.xyz += mul(unity_WorldToObject, _VertexManipulationWorldTranslation.xyz + ALWorldTranslation + heightOffset).xyz;
+
+ // rounding
+ UNITY_BRANCH
+ if (_VertexRoundingEnabled)
+ {
+ float divisionAmount = max(_VertexRoundingDivision + ALRoundingAmount, 0.0000001);
+ float3 worldRoundPosition = (ceil(mul(unity_ObjectToWorld, v.vertex.xyz) / divisionAmount) * divisionAmount) - divisionAmount * .5;
+ v.vertex.xyz = mul(unity_WorldToObject, worldRoundPosition);
+ }
+ #endif
+
+ o.objectPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1)).xyz;
+ o.objNormal = v.normal;
+ o.normal = UnityObjectToWorldNormal(v.normal);
+ o.tangent = UnityObjectToWorldDir(v.tangent);
+
+ o.binormal = cross(o.normal, o.tangent) * (v.tangent.w * unity_WorldTransformParams.w);
+ o.vertexColor = v.color;
+
+ o.uv[0] = v.uv0;
+ o.uv[1] = v.uv1;
+ o.uv[2] = v.uv2;
+ o.uv[3] = v.uv3;
+
+ #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);
+
+ o.localPos.rgb += localOffset;
+ o.worldPos.rgb += worldOffset;
+
+ o.pos = UnityObjectToClipPos(o.localPos);
+ #ifdef POI_PASS_OUTLINE
+ #if defined(UNITY_REVERSED_Z)
+ //DX
+ o.pos.z += _Offset_Z * - 0.01;
+ #else
+ //OpenGL
+ o.pos.z += _Offset_Z * 0.01;
+ #endif
+ #endif
+ o.grabPos = ComputeGrabScreenPos(o.pos);
+
+ #ifndef FORWARD_META_PASS
+ #if !defined(UNITY_PASS_SHADOWCASTER)
+ UNITY_TRANSFER_SHADOW(o, o.uv[0].xy);
+ #else
+ 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)
+ {
+ o.pos.z = o.pos.z * 0.0001 + o.pos.w * 0.999;
+ }
+ }
+
+ #ifdef POI_PASS_META
+ o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
+ #endif
+
+ #if defined(GRAIN)
+ float4 worldDirection;
+
+ worldDirection.xyz = o.worldPos.xyz - _WorldSpaceCameraPos;
+ worldDirection.w = dot(o.pos, CalculateFrustumCorrection());
+ o.worldDirection = worldDirection;
+ #endif
+ return o;
+ }
+
+ #ifdef POI_UDIMDISCARD
+ void applyUDIMDiscard(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ float2 udim = floor(poiMesh.uv[_UDIMDiscardUV].xy);
+
+ float isRendered = 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));
+
+ isRendered += (udim.y >= 0 && udim.y < 1) * dot(_UDIMDiscardRow0, xMask);
+ isRendered += (udim.y >= 1 && udim.y < 2) * dot(_UDIMDiscardRow1, xMask);
+ isRendered += (udim.y >= 2 && udim.y < 3) * dot(_UDIMDiscardRow2, xMask);
+ isRendered += (udim.y >= 3 && udim.y < 4) * dot(_UDIMDiscardRow3, xMask);
+ isRendered += (udim.y < 0 || udim.y >= 4) + (udim.x < 0 || udim.x >= 4); // never discard outside 4x4 grid in pos coords
+
+ if(!isRendered) discard;
+
+ return;
+ }
+ #endif
+
+ float2 calculatePolarCoordinate(in PoiMesh poiMesh)
+ {
+ float2 delta = poiMesh.uv[_PolarUV] - _PolarCenter;
+ float radius = length(delta) * 2 * _PolarRadialScale;
+ float angle = atan2(delta.x, delta.y) * 1.0 / 6.28 * _PolarLengthScale;
+ return float2(radius, angle + distance(poiMesh.uv[_PolarUV], _PolarCenter) * _PolarSpiralPower);
+ }
+
+ float2 MonoPanoProjection(float3 coords)
+ {
+ float3 normalizedCoords = normalize(coords);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(1.0 / UNITY_PI, 1.0 / UNITY_PI);
+ 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);
+ float latitude = acos(normalizedCoords.y);
+ float longitude = atan2(normalizedCoords.z, normalizedCoords.x);
+ float2 sphereCoords = float2(longitude, latitude) * float2(0.5 / UNITY_PI, 1.0 / UNITY_PI);
+ 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 calculatePanosphereUV(in PoiMesh poiMesh)
+ {
+ float3 viewDirection = normalize(lerp(getCameraPosition().xyz, _WorldSpaceCameraPos.xyz, _PanoUseBothEyes) - poiMesh.worldPos.xyz) * - 1;
+ return lerp(MonoPanoProjection(viewDirection), StereoPanoProjection(viewDirection), _StereoEnabled);
+ }
+
+ #ifdef USER_LUT
+ float2 distortedUV(in PoiMesh poiMesh)
+ {
+ #if defined(PROP_DISTORTIONFLOWTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 flowVector = POI2D_SAMPLER_PAN(_DistortionFlowTexture, _MainTex, poiUV(poiMesh.uv[_DistortionFlowTextureUV], _DistortionFlowTexture_ST), _DistortionFlowTexturePan) * 2 - 1;
+ #else
+ float4 flowVector = 0;
+ #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 = 0;
+ #endif
+
+ #if defined(PROP_DISTORTIONMASK) || !defined(OPTIMIZER_ENABLED)
+ half distortionMask = POI2D_SAMPLER_PAN(_DistortionMask, _MainTex, poiMesh.uv[_DistortionMaskUV], _DistortionMaskPan).r;
+ #else
+ half distortionMask = 1;
+ #endif
+
+ half distortionStrength = _DistortionStrength;
+ half distortionStrength1 = _DistortionStrength1;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (AudioLinkIsAvailable() && _EnableDistortionAudioLink && _AudioLinkAnimToggle)
+ {
+ distortionStrength += lerp(_DistortionStrengthAudioLink.x, _DistortionStrengthAudioLink.y, AudioLinkData(uint2(0, uint(_DistortionStrengthAudioLinkBand))).r);
+ 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
+
+ #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)
+ {
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ float heightMask = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r;
+ if (_HeightmaskInvert)
+ {
+ heightMask = 1 - heightMask;
+ }
+ #else
+ float heightMask = 1;
+ #endif
+
+ float2 uvs = poiUV(poiMesh.uv[_HeightMapUV], _HeightMap_ST);
+ float2 dx = ddx(uvs);
+ float2 dy = ddy(uvs);
+ float3 result = 0;
+ int stepIndex = 0;
+ int numSteps = (int)lerp(maxSamples, minSamples, saturate(dot(poiMesh.normals[0], worldViewDir)));
+ float layerHeight = 1.0 / numSteps;
+ float2 plane = parallax * heightMask * (viewDirTan.xy / viewDirTan.z);
+ uvs += refPlane * plane;
+ float2 deltaTex = -plane * layerHeight;
+ float2 prevTexOffset = 0;
+ float prevRayZ = 1.0f;
+ float prevHeight = 0.0f;
+ float2 currTexOffset = deltaTex;
+ float currRayZ = 1.0f - layerHeight;
+ float currHeight = 0.0f;
+ float intersection = 0;
+ float2 finalTexOffset = 0;
+ while (stepIndex < numSteps + 1)
+ {
+ result.z = dot(curv, currTexOffset * currTexOffset);
+ currHeight = tex2Dgrad(heightMap, uvs + currTexOffset, dx, dy).r * (1 - result.z);
+ if (currHeight > currRayZ)
+ {
+ stepIndex = numSteps + 1;
+ }
+ else
+ {
+ stepIndex++;
+ prevTexOffset = currTexOffset;
+ prevRayZ = currRayZ;
+ prevHeight = currHeight;
+ currTexOffset += deltaTex;
+ currRayZ -= layerHeight * (1 - result.z) * (1 + _CurvFix);
+ }
+ }
+ int sectionSteps = 10;
+ int sectionIndex = 0;
+ float newZ = 0;
+ float newHeight = 0;
+ while (sectionIndex < sectionSteps)
+ {
+ intersection = (prevHeight - prevRayZ) / (prevHeight - currHeight + currRayZ - prevRayZ);
+ finalTexOffset = prevTexOffset +intersection * deltaTex;
+ newZ = prevRayZ - intersection * layerHeight;
+ newHeight = tex2Dgrad(heightMap, uvs + finalTexOffset, dx, dy).r;
+ if (newHeight > newZ)
+ {
+ currTexOffset = finalTexOffset;
+ currHeight = newHeight;
+ currRayZ = newZ;
+ deltaTex = intersection * deltaTex;
+ layerHeight = intersection * layerHeight;
+ }
+ else
+ {
+ prevTexOffset = finalTexOffset;
+ prevHeight = newHeight;
+ prevRayZ = newZ;
+ deltaTex = (1 - intersection) * deltaTex;
+ layerHeight = (1 - intersection) * layerHeight;
+ }
+ sectionIndex++;
+ }
+ #ifdef UNITY_PASS_SHADOWCASTER
+ if (unity_LightShadowBias.z == 0.0)
+ {
+ #endif
+ if (result.z > 1)
+ clip(-1);
+ #ifdef UNITY_PASS_SHADOWCASTER
+ }
+ #endif
+
+ return uvs + finalTexOffset;
+ }
+ /*
+ float2 ParallaxOffsetMultiStep(float surfaceHeight, float strength, float2 uv, float3 tangentViewDir)
+ {
+ float2 uvOffset = 0;
+ float2 prevUVOffset = 0;
+ float stepSize = 1.0 / _HeightSteps;
+ float stepHeight = 1;
+ float2 uvDelta = tangentViewDir.xy * (stepSize * strength);
+ float prevStepHeight = stepHeight;
+ float prevSurfaceHeight = surfaceHeight;
+
+ [unroll(20)]
+ for (int j = 1; j <= _HeightSteps && stepHeight > surfaceHeight; j++)
+ {
+ prevUVOffset = uvOffset;
+ prevStepHeight = stepHeight;
+ prevSurfaceHeight = surfaceHeight;
+ uvOffset -= uvDelta;
+ 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;
+ stepHeight += stepSize;
+ }
+ else
+ {
+ uvOffset -= uvDelta;
+ stepHeight -= stepSize;
+ }
+ surfaceHeight = POI2D_SAMPLER_PAN(_Heightmap, _MainTex, poiUV(uv + uvOffset, _Heightmap_ST), _HeightmapPan) + _HeightOffset;
+ }
+ return uvOffset;
+ }
+ */
+ void applyParallax(inout PoiMesh poiMesh, in PoiLight poiLight, in PoiCam poiCam)
+ {
+ /*
+ half h = POI2D_SAMPLER_PAN(_Heightmap, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmap_ST), _HeightmapPan).r + _HeightOffset;
+ #if defined(PROP_HEIGHTMASK) || !defined(OPTIMIZER_ENABLED)
+ half m = POI2D_SAMPLER_PAN(_Heightmask, _linear_repeat, poiUV(poiMesh.uv[_HeightmaskUV], _Heightmask_ST), _HeightmaskPan).r + _HeightOffset;
+ #else
+ half m = 1 + _HeightOffset;
+ #endif
+ h = clamp(h, 0, 0.999);
+ m = lerp(m, 1 - m, _HeightmaskInvert);
+ #if defined(OPTIMIZER_ENABLED)das
+ poiMesh.uv[_ParallaxUV] += ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ #else
+ float2 offset = ParallaxOffsetMultiStep(h, _HeightStrength * m, poiMesh.uv[_HeightmapUV], tangentViewDir / tangentViewDir.z);
+ if (_ParallaxUV == 0) poiMesh.uv[0] += offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] += offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] += offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] += offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] += offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] += offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] += offset;
+ 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
+ float2 offset = POM(poiLight, _HeightMap, poiMesh, poiCam.viewDir, poiCam.tangentViewDir, _HeightStepsMin, _HeightStepsMax, _HeightStrength, 0, _HeightMap_ST.xy, float2(_CurvatureU, _CurvatureV));
+ if (_ParallaxUV == 0) poiMesh.uv[0] = offset;
+ if (_ParallaxUV == 1) poiMesh.uv[1] = offset;
+ if (_ParallaxUV == 2) poiMesh.uv[2] = offset;
+ if (_ParallaxUV == 3) poiMesh.uv[3] = offset;
+ if (_ParallaxUV == 4) poiMesh.uv[4] = offset;
+ if (_ParallaxUV == 5) poiMesh.uv[5] = offset;
+ if (_ParallaxUV == 6) poiMesh.uv[6] = offset;
+ if (_ParallaxUV == 7) poiMesh.uv[7] = offset;
+ #endif
+ }
+ #endif
+
+ void applyAlphaOptions(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiCam poiCam, in PoiMods poiMods)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + _AlphaMod);
+
+ // Distance Fade
+ if (_AlphaDistanceFade)
+ {
+ float3 position = _AlphaDistanceFadeType ? poiMesh.worldPos : poiMesh.objectPosition;
+ poiFragData.alpha *= lerp(_AlphaDistanceFadeMinAlpha, _AlphaDistanceFadeMaxAlpha, smoothstep(_AlphaDistanceFadeMin, _AlphaDistanceFadeMax, distance(position, poiCam.worldPos)));
+ }
+
+ // Fresnel Alpha
+ if (_AlphaFresnel)
+ {
+ float holoRim = saturate(1 - smoothstep(min(_AlphaFresnelSharpness, _AlphaFresnelWidth), _AlphaFresnelWidth, poiCam.vDotN));
+ holoRim = abs(lerp(1, holoRim, _AlphaFresnelAlpha));
+ poiFragData.alpha *= _AlphaFresnelInvert ?1 - holoRim : holoRim;
+ }
+
+ if (_AlphaAngular)
+ {
+ half cameraAngleMin = _CameraAngleMin / 180;
+ half cameraAngleMax = _CameraAngleMax / 180;
+ half modelAngleMin = _ModelAngleMin / 180;
+ half modelAngleMax = _ModelAngleMax / 180;
+ float3 pos = _AngleCompareTo == 0 ? poiMesh.objectPosition : poiMesh.worldPos;
+ half3 cameraToModelDirection = normalize(pos - getCameraPosition());
+ half3 modelForwardDirection = normalize(mul(unity_ObjectToWorld, normalize(_AngleForwardDirection.rgb)));
+ half cameraLookAtModel = remapClamped(cameraAngleMax, cameraAngleMin, .5 * dot(cameraToModelDirection, getCameraForward()) + .5);
+ half modelLookAtCamera = remapClamped(modelAngleMax, modelAngleMin, .5 * dot(-cameraToModelDirection, modelForwardDirection) + .5);
+ if (_AngleType == 0)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel, _AngleMinAlpha);
+ }
+ else if (_AngleType == 1)
+ {
+ poiFragData.alpha *= max(modelLookAtCamera, _AngleMinAlpha);
+ }
+ else if (_AngleType == 2)
+ {
+ poiFragData.alpha *= max(cameraLookAtModel * modelLookAtCamera, _AngleMinAlpha);
+ }
+ }
+
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable && _AlphaAudioLinkEnabled)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha + lerp(_AlphaAudioLinkAddRange.x, _AlphaAudioLinkAddRange.y, poiMods.audioLink[_AlphaAudioLinkAddBand]));
+ }
+ #endif
+ }
+
+ inline half Dither8x8Bayer(int x, int y)
+ {
+ const half dither[ 64 ] = {
+ 1, 49, 13, 61, 4, 52, 16, 64,
+ 33, 17, 45, 29, 36, 20, 48, 32,
+ 9, 57, 5, 53, 12, 60, 8, 56,
+ 41, 25, 37, 21, 44, 28, 40, 24,
+ 3, 51, 15, 63, 2, 50, 14, 62,
+ 35, 19, 47, 31, 34, 18, 46, 30,
+ 11, 59, 7, 55, 10, 58, 6, 54,
+ 43, 27, 39, 23, 42, 26, 38, 22
+ };
+ int r = y * 8 + x;
+ return dither[r] / 64;
+ }
+
+ half calcDither(half2 grabPos)
+ {
+ return Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
+ }
+
+ void applyDithering(inout PoiFragData poiFragData, in PoiCam poiCam)
+ {
+ if (_AlphaDithering)
+ {
+ poiFragData.alpha = saturate(poiFragData.alpha - (calcDither(poiCam.screenUV) * (1 - poiFragData.alpha) * _AlphaDitherGradient));
+ }
+ }
+
+ void ApplyAlphaToCoverage(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ // Force Model Opacity to 1 if desired
+ UNITY_BRANCH
+ if (_Mode == 1)
+ {
+ UNITY_BRANCH
+ if (_AlphaSharpenedA2C && _AlphaToCoverage)
+ {
+ // rescale alpha by mip level
+ poiFragData.alpha *= 1 + max(0, CalcMipLevel(poiMesh.uv[0] * _MainTex_TexelSize.zw)) * _AlphaMipScale;
+ // rescale alpha by partial derivative
+ poiFragData.alpha = (poiFragData.alpha - _Cutoff) / max(fwidth(poiFragData.alpha), 0.0001) + _Cutoff;
+ poiFragData.alpha = saturate(poiFragData.alpha);
+ }
+ }
+ }
+
+ void applyVertexColor(inout PoiFragData poiFragData, PoiMesh poiMesh)
+ {
+ #ifndef POI_PASS_OUTLINE
+ float3 vertCol = lerp(poiMesh.vertexColor.rgb, GammaToLinearSpace(poiMesh.vertexColor.rgb), _MainVertexColoringLinearSpace);
+ poiFragData.baseColor *= lerp(1, vertCol, _MainVertexColoring);
+ #endif
+ poiFragData.alpha *= lerp(1, poiMesh.vertexColor.a, _MainUseVertexColorAlpha);
+ }
+
+ #ifdef POI_BACKFACE
+ void ApplyBackFaceColor(inout PoiFragData poiFragData, in PoiMesh poiMesh, inout PoiMods poiMods)
+ {
+ if (!poiMesh.isFrontFace)
+ {
+ float4 backFaceColor = _BackFaceColor;
+ backFaceColor.rgb = poiThemeColor(poiMods, backFaceColor.rgb, _BackFaceColorThemeIndex);
+ #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);
+
+ float backFaceMask = 1;
+ #if defined(PROP_BACKFACEMASK) || !defined(OPTIMIZER_ENABLED)
+ backFaceMask *= POI2D_SAMPLER_PAN(_BackFaceMask, _MainTex, poiUV(poiMesh.uv[_BackFaceMaskUV], _BackFaceMask_ST), _BackFaceMaskPan).r * _BackFaceAlpha * backFaceColor.a;
+ #endif
+
+ poiFragData.baseColor = lerp(poiFragData.baseColor, backFaceColor.rgb, backFaceMask);
+
+ UNITY_BRANCH
+ if (_BackFaceReplaceAlpha)
+ {
+ poiFragData.alpha = lerp(backFaceColor.a, poiFragData.alpha, backFaceMask);
+ }
+
+ poiFragData.emission += backFaceColor.rgb * _BackFaceEmissionStrength * backFaceMask;
+ poiMods.globalEmission = min(poiMods.globalEmission, _BackFaceEmissionLimiter);
+ }
+ }
+ #endif
+
+ #ifdef DISTORT
+ void applyDissolve(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ #if defined(PROP_DISSOLVEMASK) || !defined(OPTIMIZER_ENABLED)
+ float dissolveMask = POI2D_SAMPLER_PAN(_DissolveMask, _MainTex, poiUV(poiMesh.uv[_DissolveMaskUV], _DissolveMask_ST), _DissolveMaskPan).r;
+ #else
+ float dissolveMask = 1;
+ #endif
+ UNITY_BRANCH
+ if (_DissolveUseVertexColors)
+ {
+ // Vertex Color Imprecision hype
+ dissolveMask = ceil(poiMesh.vertexColor.g * 100000) / 100000;
+ }
+
+ #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;
+ #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
+ + _DissolveAlpha2
+ + _DissolveAlpha3
+ + _DissolveAlpha4
+ + _DissolveAlpha5
+ + _DissolveAlpha6
+ + _DissolveAlpha7
+ + _DissolveAlpha8
+ + _DissolveAlpha9;
+ float dds = _DissolveDetailStrength;
+
+ #ifdef POI_AUDIOLINK
+ UNITY_BRANCH
+ if (_EnableDissolveAudioLink && poiMods.audioLinkAvailable)
+ {
+ da += lerp(_AudioLinkDissolveAlpha.x, _AudioLinkDissolveAlpha.y, poiMods.audioLink[_AudioLinkDissolveAlphaBand]);
+ dds += lerp(_AudioLinkDissolveDetail.x, _AudioLinkDissolveDetail.y, poiMods.audioLink[_AudioLinkDissolveDetailBand]);
+ }
+ #endif
+
+ da = saturate(da);
+ dds = saturate(dds);
+
+ #ifdef POI_BLACKLIGHT
+ if (_BlackLightMaskDissolve != 4)
+ {
+ dissolveMask *= blackLightMask[_BlackLightMaskDissolve];
+ }
+ #endif
+
+ if (_DissolveMaskInvert)
+ {
+ dissolveMask = 1 - dissolveMask;
+ }
+ #if defined(PROP_DISSOLVEDETAILNOISE) || !defined(OPTIMIZER_ENABLED)
+ float dissolveDetailNoise = POI2D_SAMPLER_PAN(_DissolveDetailNoise, _MainTex, poiUV(poiMesh.uv[_DissolveDetailNoiseUV], _DissolveDetailNoise_ST), _DissolveDetailNoisePan);
+ #else
+ float dissolveDetailNoise = 0;
+ #endif
+ if (_DissolveInvertNoise)
+ {
+ dissolveNoiseTexture = 1 - dissolveNoiseTexture;
+ }
+ if (_DissolveInvertDetailNoise)
+ {
+ dissolveDetailNoise = 1 - dissolveDetailNoise;
+ }
+ if (_ContinuousDissolve != 0)
+ {
+ da = sin(_Time.x * _ContinuousDissolve) * .5 + .5;
+ }
+ da *= dissolveMask;
+ dissolveAlpha = da;
+ edgeAlpha = 0;
+
+ if (_DissolveType == 1) // Basic
+
+ {
+ da = remap(da, 0, 1, -_DissolveEdgeWidth, 1);
+ dissolveAlpha = da;
+ //Adjust detail strength to avoid artifacts
+ dds *= smoothstep(1, .99, da);
+ float noise = saturate(dissolveNoiseTexture - dissolveDetailNoise * dds);
+
+ noise = saturate(noise * 0.998 + 0.001);
+ //noise = remap(noise, 0, 1, _DissolveEdgeWidth, 1 - _DissolveEdgeWidth);
+ dissolveAlpha = dissolveAlpha >= noise;
+ edgeAlpha = remapClamped(da + _DissolveEdgeWidth, da, noise) * (1 - dissolveAlpha);
+ }
+ else if (_DissolveType == 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)
+ {
+ float3 pos = _DissolveP2PWorldLocal == 0 ? poiMesh.localPos.rgb : poiMesh.vertexColor.rgb;
+ distanceTo = dot(pos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ else
+ {
+ distanceTo = dot(poiMesh.worldPos - currentPos, direction) - dissolveDetailNoise * dds;
+ edgeAlpha = smoothstep(_DissolveP2PEdgeLength + .00001, 0, distanceTo);
+ dissolveAlpha = step(distanceTo, 0);
+ edgeAlpha *= 1 - dissolveAlpha;
+ }
+ }
+
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveHueShiftEnabled)
+ {
+ dissolveToTexture.rgb = hueShift(dissolveToTexture.rgb, _DissolveHueShift + _Time.x * _DissolveHueShiftSpeed);
+ }
+ #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);
+
+ UNITY_BRANCH
+ if (_DissolveEdgeWidth)
+ {
+ edgeColor = tex2D(_DissolveEdgeGradient, poiUV(float2(edgeAlpha, edgeAlpha), _DissolveEdgeGradient_ST)) * float4(poiThemeColor(poiMods, _DissolveEdgeColor.rgb, _DissolveEdgeColorThemeIndex), _DissolveEdgeColor.a);
+ #ifndef POI_SHADOW
+ UNITY_BRANCH
+ if (_DissolveEdgeHueShiftEnabled)
+ {
+ edgeColor.rgb = hueShift(edgeColor.rgb, _DissolveEdgeHueShift + _Time.x * _DissolveEdgeHueShiftSpeed);
+ }
+ #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
+
+ /*
+ Liltoon made most of this and it looked really good so I modified it to be a little more poi
+
+ MIT License
+
+ Copyright (c) 2020-2021 lilxyzw
+
+ 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
+ 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.
+ */
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ void ApplyAudioLinkDecal(in PoiMesh poiMesh, inout PoiFragData poiFragData, in PoiMods poiMods)
+ {
+ float4 colorAndMask = float4(1, 1, 1, 1);
+ #if defined(PROP_ALDECALCOLORMASK) || !defined(OPTIMIZER_ENABLED)
+ colorAndMask = POI2D_SAMPLER_PAN(_ALDecalColorMask, _MainTex, poiUV(poiMesh.uv[_ALDecalColorMaskUV], _ALDecalColorMask_ST), _ALDecalColorMaskPan);
+ #endif
+
+ float2 uv = poiMesh.uv[_ALDecalUV];
+ float2 decalCenter = _ALUVPosition;
+ float theta = radians(_ALUVRotation + _Time.z * _ALUVRotationSpeed);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ uv = float2((uv.x - decalCenter.x) * cs - (uv.y - decalCenter.y) * sn + decalCenter.x, (uv.x - decalCenter.x) * sn + (uv.y - decalCenter.y) * cs + decalCenter.y);
+ uv = remap(uv, float2(0, 0) - _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)
+ {
+ float2 uvdir = uv * 2 - 1;
+ 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)
+ {
+ maskY = remap(maskY, _ALDecaldCircleDimensions.x, _ALDecaldCircleDimensions.y, 0, 1);
+ }
+ float maskX = aluv.x;
+ if (_ALDecalUVMode == 1)
+ {
+ 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;
+ float4 audioTexture = _AudioTexture.Sample(sampler_linear_clamp, audioLinkUV);
+ float audioVal = audioTexture.b * _ALDecalVolume * lerp(_ALDecalBaseBoost, _ALDecalTrebleBoost, audioLinkMask.g);
+ float audioLinkValue = _ALDecalLineWidth < 1.0 ? abs(audioVal - audioLinkMask.r) < _ALDecalLineWidth : audioVal > audioLinkMask.r * 2.0;
+ 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 volumeColor = lerp(_ALDecalVolumeColorLow.rgb, _ALDecalVolumeColorMid.rgb, saturate(volumeColorSrc * 2));
+ volumeColor = lerp(volumeColor, _ALDecalVolumeColorHigh.rgb, saturate(volumeColorSrc * 2 - 1));
+
+ float3 emissionColor = lerp(_ALDecalVolumeColorLow.rgb * _ALDecalLowEmission, _ALDecalVolumeColorMid.rgb * _ALDecalMidEmission, saturate(volumeColorSrc * 2));
+ emissionColor = lerp(emissionColor, _ALDecalVolumeColorHigh.rgb * _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;
+ poiFragData.baseColor.rgb = lerp(poiFragData.baseColor, customBlend(poiFragData.baseColor, volumeColor * colorAndMask.rgb, _ALDecalBlendType), saturate(_ALDecalBlendAlpha * audioLinkValue));
+ #endif
+ poiFragData.alpha = lerp(poiFragData.alpha, poiFragData.alpha * audioLinkValue, _ALDecalControlsAlpha);
+ }
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+
+ void applyFlipbook(inout PoiFragData poiFragData, in PoiMesh poiMesh, in PoiMods poiMods)
+ {
+ float4 flipBookPixel = float4(0, 0, 0, 0);
+ #if defined(PROP_FLIPBOOKMASK) || !defined(OPTIMIZER_ENABLED)
+ float flipBookMask = POI2D_SAMPLER_PAN(_FlipbookMask, _MainTex, poiMesh.uv[_FlipbookMaskUV], _FlipbookMaskPan).r;
+ #else
+ float flipBookMask = 1;
+ #endif
+ 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);
+ float cs = cos(theta);
+ float sn = sin(theta);
+ float2 spriteCenter = flipbookScaleOffset.zw + .5;
+ // 2d rotation
+ 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)
+ {
+ if (max(newUV.x, newUV.y) > 1 || min(newUV.x, newUV.y) < 0)
+ {
+ return;
+ }
+ }
+ #if defined(PROP_FLIPBOOKTEXARRAY) || !defined(OPTIMIZER_ENABLED)
+ float currentFrame = 0;
+ if (!_FlipbookManualFrameControl)
+ {
+ if (_FlipbookFPS != 0)
+ {
+ currentFrame = (_Time.y / (1 / _FlipbookFPS)) % _FlipbookTotalFrames;
+ }
+ }
+ else
+ {
+ currentFrame = fmod(_FlipbookCurrentFrame, _FlipbookTotalFrames);
+ }
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ if (_FlipbookChronotensityEnabled)
+ {
+ currentFrame += AudioLinkGetChronoTime(_FlipbookChronoType, _FlipbookChronotensityBand) * _FlipbookChronotensitySpeed;
+ }
+ currentFrame += lerp(_AudioLinkFlipbookFrame.x, _AudioLinkFlipbookFrame.y, poiMods.audioLink[_AudioLinkFlipbookFrameBand]);
+ currentFrame %= _FlipbookTotalFrames;
+ }
+ #endif
+ flipBookPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor(currentFrame)));
+ UNITY_BRANCH
+ if (_FlipbookCrossfadeEnabled)
+ {
+ float4 flipbookNextPixel = UNITY_SAMPLE_TEX2DARRAY(_FlipbookTexArray, float3(TRANSFORM_TEX(newUV, _FlipbookTexArray) + _Time.x * _FlipbookTexArrayPan, floor((currentFrame + 1) % _FlipbookTotalFrames)));
+ flipBookPixel = lerp(flipBookPixel, flipbookNextPixel, smoothstep(_FlipbookCrossfadeRange.x, _FlipbookCrossfadeRange.y, frac(currentFrame)));
+ }
+ #else
+ flipBookPixel = 1;
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookIntensityControlsAlpha)
+ {
+ flipBookPixel.a = poiMax(flipBookPixel.rgb);
+ }
+ UNITY_BRANCH
+ if (_FlipbookColorReplaces)
+ {
+ flipBookPixel.rgb = poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+ else
+ {
+ flipBookPixel.rgb *= poiThemeColor(poiMods, _FlipbookColor.rgb, _FlipbookColorThemeIndex);
+ }
+
+ #ifdef POI_BLACKLIGHT
+ UNITY_BRANCH
+ if (_BlackLightMaskFlipbook != 4)
+ {
+ flipBookMask *= blackLightMask[_BlackLightMaskFlipbook];
+ }
+ #endif
+
+ UNITY_BRANCH
+ if (_FlipbookHueShiftEnabled)
+ {
+ flipBookPixel.rgb = hueShift(flipBookPixel.rgb, _FlipbookHueShift + _Time.x * _FlipbookHueShiftSpeed);
+ }
+ half flipbookAlpha = 1;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * _FlipbookReplace * flipBookMask * flipbookAlpha);
+ poiFragData.baseColor = poiFragData.baseColor + flipBookPixel.rgb * _FlipbookAdd * flipBookMask * flipbookAlpha;
+ poiFragData.baseColor = poiFragData.baseColor * lerp(1, flipBookPixel.rgb, flipBookPixel.a * _FlipbookColor.a * flipBookMask * _FlipbookMultiply * flipbookAlpha);
+
+ float flipbookEmissionStrength = _FlipbookEmissionStrength;
+ #ifdef POI_AUDIOLINK
+ if (poiMods.audioLinkAvailable)
+ {
+ 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)
+ {
+ poiFragData.alpha = lerp(poiFragData.alpha, flipBookPixel.a * _FlipbookColor.a, flipBookMask);
+ }
+ }
+
+ #endif
+
+ #ifdef POI_MIRROR
+ void applyMirror(inout PoiFragData poiFragData, in PoiMesh poiMesh)
+ {
+ bool inMirror = IsInMirror();
+ if (_Mirror != 0)
+ {
+ if (_Mirror == 1 && inMirror) return;
+ if (_Mirror == 1 && !inMirror) discard;
+ if (_Mirror == 2 && inMirror) discard;
+ if (_Mirror == 2 && !inMirror) return;
+ }
+
+ #if(defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS))
+ #if defined(PROP_MIRRORTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ if(inMirror)
+ {
+ poiFragData.baseColor = POI2D_SAMPLER_PAN(_MirrorTexture, _MainTex, poiMesh.uv[_MirrorTextureUV], _MirrorTexturePan);
+ }
+ #endif
+ #endif
+ }
+ #endif
+
+ #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.grabPos.xy * 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).r;
+ #else
+ float depthMask = 1;
+ #endif
+
+ 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)
+ {
+ depthTextureUV = lerp(0, 1, remapClamped(_DepthColorMinDepth, _DepthColorMaxDepth, diff));
+ }
+ else
+ {
+ depthTextureUV = poiMesh.uv[_DepthTextureUV];
+ }
+ float3 depthColor = POI2D_SAMPLER_PAN(_DepthTexture, _MainTex, poiUV(depthTextureUV, _DepthTexture_ST), _DepthTexturePan).rgb * poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #else
+ float3 depthColor = poiThemeColor(poiMods, _DepthColor, _DepthColorThemeIndex);
+ #endif
+
+ switch(_DepthColorBlendMode)
+ {
+ case 0:
+ {
+ poiFragData.finalColor = lerp(poiFragData.finalColor, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 1:
+ {
+ poiFragData.finalColor *= lerp(1, depthColor, colorBlendAlpha * depthMask);
+ break;
+ }
+ case 2:
+ {
+ poiFragData.finalColor = saturate(poiFragData.finalColor + lerp(0, depthColor, colorBlendAlpha * depthMask));
+ break;
+ }
+ }
+ poiFragData.emission += depthColor * colorBlendAlpha * _DepthEmissionStrength * depthMask;
+ }
+
+ if (_DepthAlphaToggle)
+ {
+ poiFragData.alpha *= lerp(poiFragData.alpha, saturate(lerp(_DepthAlphaMinValue, _DepthAlphaMaxValue, remapClamped(_DepthAlphaMinDepth, _DepthAlphaMaxDepth, diff))), depthMask);
+ }
+ }
+ #endif
+
+ float4 frag(v2f i, uint facing : SV_IsFrontFace) : SV_Target
+ {
+ #ifdef GRAIN
+ clip(-1);
+ return 0;
+ #endif
+
+ 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.emission = 0;
+ poiFragData.baseColor = float3(0, 0, 0);
+ poiFragData.finalColor = float3(0, 0, 0);
+ poiFragData.alpha = 1;
+
+ // Mesh Data
+ poiMesh.objectPosition = i.objectPos;
+ poiMesh.objNormal = i.objNormal;
+ poiMesh.normals[0] = i.normal;
+ poiMesh.tangent = i.tangent;
+ poiMesh.binormal = i.binormal;
+ poiMesh.worldPos = i.worldPos.xyz;
+ poiMesh.localPos = i.localPos.xyz;
+ poiMesh.vertexColor = i.vertexColor;
+ poiMesh.isFrontFace = facing;
+
+ #ifndef POI_PASS_OUTLINE
+ if (!poiMesh.isFrontFace)
+ {
+ poiMesh.normals[0] *= -1;
+ poiMesh.tangent *= -1;
+ poiMesh.binormal *= -1;
+ }
+ #endif
+
+ poiCam.viewDir = !IsOrthographicCamera() ? normalize(_WorldSpaceCameraPos - i.worldPos.xyz) : normalize(UNITY_MATRIX_I_V._m02_m12_m22);
+ float3 tanToWorld0 = float3(i.tangent.x, i.binormal.x, i.normal.x);
+ float3 tanToWorld1 = float3(i.tangent.y, i.binormal.y, i.normal.y);
+ float3 tanToWorld2 = float3(i.tangent.z, i.binormal.z, i.normal.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
+ // 6 Polar UV
+ // 6 Distorted UV
+ #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
+ poiMesh.lightmapUV = i.lightmapUV;
+ #endif
+ poiMesh.parallaxUV = poiCam.tangentViewDir.xy / max(poiCam.tangentViewDir.z, 0.0001);
+ poiMesh.uv[0] = i.uv[0];
+ poiMesh.uv[1] = i.uv[1];
+ poiMesh.uv[2] = i.uv[2];
+ poiMesh.uv[3] = i.uv[3];
+ poiMesh.uv[4] = poiMesh.uv[0];
+ poiMesh.uv[5] = poiMesh.worldPos.xz;
+ poiMesh.uv[6] = poiMesh.uv[0];
+ poiMesh.uv[7] = poiMesh.uv[0];
+
+ poiMesh.uv[4] = calculatePanosphereUV(poiMesh);
+ poiMesh.uv[6] = calculatePolarCoordinate(poiMesh);
+ #ifdef USER_LUT
+ poiMesh.uv[7] = distortedUV(poiMesh);
+ #endif
+ /*
+ half3 worldViewUp = normalize(half3(0, 1, 0) - poiCam.viewDir * dot(poiCam.viewDir, half3(0, 1, 0)));
+ half3 worldViewRight = normalize(cross(poiCam.viewDir, worldViewUp));
+ poiMesh[8] = half2(dot(worldViewRight, poiMesh.normals[_MatcapNormal]), dot(worldViewUp, poiMesh.normals[_MatcapNormal])) * _MatcapBorder + 0.5;
+ */
+
+ #ifdef POI_PARALLAX
+ #ifndef POI_PASS_OUTLINE
+ //return frac(i.tangentViewDir.x);
+ //return float4(i.binormal.xyz,1);
+ applyParallax(poiMesh, poiLight, poiCam);
+ #endif
+ #endif
+
+ float4 mainTexture = UNITY_SAMPLE_TEX2D(_MainTex, poiUV(poiMesh.uv[_MainTexUV].xy, _MainTex_ST) + _Time.x * _MainTexPan);
+
+ float3 mainNormal = UnpackScaleNormal(POI2D_SAMPLER_PAN(_BumpMap, _MainTex, poiUV(poiMesh.uv[_BumpMapUV], _BumpMap_ST), _BumpMapPan), _BumpScale);
+ poiMesh.tangentSpaceNormal = mainNormal;
+
+ #if defined(FINALPASS) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ ApplyDetailNormal(poiMods, poiMesh);
+ #endif
+
+ #if defined(GEOM_TYPE_MESH) && defined(VIGNETTE) && !defined(UNITY_PASS_SHADOWCASTER) && !defined(POI_PASS_OUTLINE)
+ calculateRGBNormals(poiMesh);
+ #endif
+
+ poiMesh.normals[1] = normalize(
+ poiMesh.tangentSpaceNormal.x * poiMesh.tangent.xyz +
+ poiMesh.tangentSpaceNormal.y * poiMesh.binormal +
+ poiMesh.tangentSpaceNormal.z * poiMesh.normals[0]
+ );
+
+ // I'm just testing this because it makes it the same as if there is no normal map in the slot
+ float3 fancyNormal = UnpackNormal(float4(0.5, 0.5, 1, 1));
+ poiMesh.normals[0] = normalize(
+ fancyNormal.x * poiMesh.tangent.xyz +
+ fancyNormal.y * poiMesh.binormal +
+ fancyNormal.z * poiMesh.normals[0]
+ );
+
+ // Camera data
+ poiCam.forwardDir = getCameraForward();
+ poiCam.worldPos = _WorldSpaceCameraPos;
+ poiCam.reflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[1]);
+ poiCam.vertexReflectionDir = reflect(-poiCam.viewDir, poiMesh.normals[0]);
+ //poiCam.distanceToModel = distance(poiMesh.modelPos, poiCam.worldPos);
+ poiCam.distanceToVert = distance(poiMesh.worldPos, poiCam.worldPos);
+ poiCam.grabPos = i.grabPos;
+ poiCam.screenUV = calcScreenUVs(i.grabPos);
+ poiCam.vDotN = abs(dot(poiCam.viewDir, poiMesh.normals[1]));
+ poiCam.clipPos = i.pos;
+ poiCam.worldDirection = i.worldDirection;
+
+ #ifdef POI_AUDIOLINK
+ SetupAudioLink(poiFragData, poiMods, poiMesh);
+ #endif
+
+ #ifdef POI_UDIMDISCARD
+ applyUDIMDiscard(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.baseColor = mainTexture.rgb * poiThemeColor(poiMods, _Color.rgb, _ColorThemeIndex);
+ poiFragData.alpha = mainTexture.a * _Color.a;
+
+ #ifdef COLOR_GRADING_HDR
+ #if defined(PROP_MAINCOLORADJUSTTEXTURE) || !defined(OPTIMIZER_ENABLED)
+ float4 hueShiftAlpha = POI2D_SAMPLER_PAN(_MainColorAdjustTexture, _MainTex, poiUV(poiMesh.uv[_MainColorAdjustTextureUV], _MainColorAdjustTexture_ST), _MainColorAdjustTexturePan);
+ #else
+ float4 hueShiftAlpha = 1;
+ #endif
+
+ if (_MainHueShiftToggle)
+ {
+ float shift = _MainHueShift;
+ #ifdef POI_AUDIOLINK
+ //UNITY_BRANCH
+ if (poiMods.audioLinkAvailable && _MainHueALCTEnabled)
+ {
+ shift += AudioLinkGetChronoTime(_MainALHueShiftCTIndex, _MainALHueShiftBand) * _MainHueALMotionSpeed;
+ }
+ #endif
+ if (_MainHueShiftReplace)
+ {
+ poiFragData.baseColor = lerp(poiFragData.baseColor, hueShift(poiFragData.baseColor, shift + _MainHueShiftSpeed * _Time.x), hueShiftAlpha.r);
+ }
+ else
+ {
+ poiFragData.baseColor = hueShift(poiFragData.baseColor, frac((shift - (1 - hueShiftAlpha.r) + _MainHueShiftSpeed * _Time.x)));
+ }
+ }
+ poiFragData.baseColor = lerp(poiFragData.baseColor, dot(poiFragData.baseColor, float3(0.3, 0.59, 0.11)), -_Saturation * hueShiftAlpha.b);
+ poiFragData.baseColor = saturate(poiFragData.baseColor + _MainBrightness * hueShiftAlpha.g);
+ #endif
+
+ #if defined(PROP_CLIPPINGMASK) || !defined(OPTIMIZER_ENABLED)
+ float alphaMask = POI2D_SAMPLER_PAN(_ClippingMask, _MainTex, poiUV(poiMesh.uv[_ClippingMaskUV], _ClippingMask_ST), _ClippingMaskPan).r;
+ if (_Inverse_Clipping)
+ {
+ alphaMask = 1 - alphaMask;
+ }
+ #else
+ float alphaMask = 1;
+ #endif
+
+ poiFragData.alpha *= alphaMask;
+
+ applyAlphaOptions(poiFragData, poiMesh, poiCam, poiMods);
+
+ applyVertexColor(poiFragData, poiMesh);
+
+ #ifdef POI_BACKFACE
+ ApplyBackFaceColor(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef DISTORT
+ applyDissolve(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_AUDIOLINK
+ #ifdef POI_AL_DECAL
+ ApplyAudioLinkDecal(poiMesh, poiFragData, poiMods);
+ #endif
+ #endif
+
+ #ifdef _SUNDISK_HIGH_QUALITY
+ applyFlipbook(poiFragData, poiMesh, poiMods);
+ #endif
+
+ #ifdef POI_MIRROR
+ applyMirror(poiFragData, poiMesh);
+ #endif
+
+ poiFragData.finalColor = poiFragData.baseColor;
+
+ #ifdef GRAIN
+ applyDepthFX(poiFragData, poiCam, poiMesh, poiMods);
+ #endif
+
+ //UNITY_BRANCH
+ if (_IgnoreFog == 0)
+ {
+ UNITY_APPLY_FOG(i.fogCoord, poiFragData.finalColor);
+ }
+
+ poiFragData.alpha = _AlphaForceOpaque ? 1 : poiFragData.alpha;
+
+ ApplyAlphaToCoverage(poiFragData, poiMesh);
+
+ applyDithering(poiFragData, poiCam);
+
+ if (_Mode == POI_MODE_OPAQUE)
+ {
+ poiFragData.alpha = 1;
+ }
+
+ clip(poiFragData.alpha - _Cutoff);
+
+ if (_Mode == POI_MODE_FADE)
+ {
+ clip(poiFragData.alpha - 0.01);
+ }
+
+ return float4(poiFragData.finalColor, poiFragData.alpha) + POI_SAFE_RGB0;
+ }
+
+ ENDCG
+
+ }
+
+ }
+ CustomEditor "Thry.ShaderEditor"
+}
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi.shader.meta
new file mode 100644
index 00000000..912d6709
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/8.1/Pro/Poiyomi.shader.meta
@@ -0,0 +1,15 @@
+fileFormatVersion: 2
+guid: 3cdd65ddb8a8d4248989a107ac3455bb
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ nonModifiableTextures:
+ - _ClothDFG: {fileID: 2800000, guid: 76d65cbce584df7449699fb8406f60ea, type: 3}
+ - _SkinLUT: {fileID: 2800000, guid: d13510bb2be49aa40a66a0101efb6a36, type: 3}
+ - _ToonRamp: {fileID: 2800000, guid: 61bd594533da4fc42bd46ef93ba5a4f6, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras.meta
new file mode 100644
index 00000000..d8d5cf68
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: cb514bdc28c681942916ac4a6f8aa683
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/InvisStencil.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/InvisStencil.shader
new file mode 100644
index 00000000..b47468ab
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/InvisStencil.shader
@@ -0,0 +1,72 @@
+Shader ".poiyomi/Extras/StencilInvis"
+{
+ properties
+ {
+ [HideInInspector] m_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+
+ [HideInInspector] m_renderingOptions ("Rendering Options", Float) = 0
+ [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", Float) = 2
+ [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Float) = 4
+ [Enum(UnityEngine.Rendering.BlendMode)] _SourceBlend ("Source Blend", Float) = 5
+ [Enum(UnityEngine.Rendering.BlendMode)] _DestinationBlend ("Destination Blend", Float) = 10
+ [Enum(Off, 0, On, 1)] _ZWrite ("ZWrite", Int) = 1
+ }
+ CustomEditor "ThryEditor"
+ SubShader
+ {
+
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" }
+ ColorMask 0
+ ZWrite [_ZWrite]
+ Cull [_Cull]
+ ZTest [_ZTest]
+ Offset [_ZBias], [_ZBias]
+ Stencil
+ {
+ Ref [_StencilRef]
+ Comp [_StencilCompareFunction]
+ Pass [_StencilPassOp]
+ Fail [_StencilFailOp]
+ ZFail [_StencilZFailOp]
+ }
+
+ CGINCLUDE
+ struct appdata
+ {
+ float4 vertex: POSITION;
+ };
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ };
+ v2f vert(appdata v)
+ {
+ v2f o;
+ o.pos = UnityObjectToClipPos(v.vertex);
+ return o;
+ }
+ half4 frag(v2f i): COLOR
+ {
+ return half4(1, 1, 0, 1);
+ }
+ ENDCG
+
+ Pass
+ {
+
+ CGPROGRAM
+
+ #pragma vertex vert
+ #pragma fragment frag
+ ENDCG
+
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/InvisStencil.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/InvisStencil.shader.meta
new file mode 100644
index 00000000..ac593884
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/InvisStencil.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a49dd2fba12886c499261512c6eaaa80
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/MasterScanner.shader b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/MasterScanner.shader
new file mode 100644
index 00000000..82a1ea79
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/MasterScanner.shader
@@ -0,0 +1,62 @@
+Shader ".poiyomi/Extras/MasterScanner"
+{
+ properties
+ {
+ [HideInInspector] m_StencilPassOptions ("Stencil", Float) = 0
+ [IntRange] _StencilRef ("Stencil Reference Value", Range(0, 255)) = 0
+ //[IntRange] _StencilReadMaskRef ("Stencil ReadMask Value", Range(0, 255)) = 0
+ //[IntRange] _StencilWriteMaskRef ("Stencil WriteMask Value", Range(0, 255)) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilPassOp ("Stencil Pass Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilFailOp ("Stencil Fail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFailOp ("Stencil ZFail Op", Float) = 0
+ [Enum(UnityEngine.Rendering.CompareFunction)] _StencilCompareFunction ("Stencil Compare Function", Float) = 8
+ }
+ CustomEditor "ThryEditor"
+ SubShader
+ {
+
+ Tags { "Queue" = "background" }
+ ColorMask 0
+ ZWrite Off
+ Cull Off
+ ZTest Always
+ Stencil
+ {
+ Ref 901
+ Comp Always
+ Pass Replace
+ }
+
+ CGINCLUDE
+ struct appdata
+ {
+ float4 vertex: POSITION;
+ };
+ struct v2f
+ {
+ float4 pos: SV_POSITION;
+ };
+ v2f vert(appdata v)
+ {
+ v2f o;
+ o.pos = UnityObjectToClipPos(v.vertex);
+ return o;
+ }
+ half4 frag(v2f i): COLOR
+ {
+ return half4(1, 1, 0, 1);
+ }
+ ENDCG
+
+ Pass
+ {
+
+ CGPROGRAM
+
+ #pragma vertex vert
+ #pragma fragment frag
+ ENDCG
+
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/MasterScanner.shader.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/MasterScanner.shader.meta
new file mode 100644
index 00000000..72b33770
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/Extras/MasterScanner.shader.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: add1d40d10695a24b9e91e172ccb9525
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/PoiLabels.txt b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/PoiLabels.txt
new file mode 100644
index 00000000..61838a27
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/PoiLabels.txt
@@ -0,0 +1,298 @@
+--{reference_property:REFERENCEA,button_right:{text:Tutorial,action:{type:URL,data:URLSTRING},hover:YouTube}}
+THINGASD:=NAMESD--{hide_in_inspector:true}
+
+reference_property:REFERENCEA,
+
+--{reference_property:REFERENCEA}
+:=--{reference_property:REFERENCEA}
+
+--{button_right:{text:Tutorial,action:{type:URL,data:URLSTRING},hover:YouTube}}
+
+--{hide_in_inspector:true}
+
+// Main
+m_mainOptions:=Main--{button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=5yxREJE8DPA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},is_visible_simple:true}
+_MainTex:=Main Texture--{reference_properties:[_MainTexPan, _MainTextureUV]}
+_BumpMap:=Normal Map--{reference_properties:[_BumpMapPan, _BumpMapUV]}
+_AlphaMask:=Alpha Map--{reference_properties:[_AlphaMaskPan, _AlphaMaskUV]}
+_VertexManipulationHeightMask:=Height Map--{reference_properties:[_VertexManipulationHeightPan, _VertexManipulationHeightUV]}
+_BackFaceTexture:= Texture--{reference_properties:[_BackFacePanning, _BackFaceTextureUV]}
+
+// RGB Mask
+m_start_RGBMask:=RGB Mask--{button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=VVJ9Ac1_fXk&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_RGBMaskEnabled,is_hideable:true}
+_RGBMask:=RGB Mask--{reference_properties:[_RGBMaskPanning, _RGBMaskUV]}
+_RedTexure:=R Texture--{reference_properties:[_RGBRedPanning, _RGBRed_UV]}
+_GreenTexture:=G Texture--{reference_properties:[_RGBGreenPanning, _RGBGreen_UV]}
+_BlueTexture:=B Texture--{reference_properties:[_RGBBluePanning, _RGBBlue_UV]}
+
+// Hue Shift
+m_start_MainHueShift:=Hue Shift--{button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=Asj7u0Wd5T4&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_MainHueShiftToggle,is_hideable:true}
+_MainHueShiftMask:=Mask--{reference_properties:[_MainHueShiftMaskPan, _MainHueShiftMaskUV]}
+
+// Decal
+m_start_DecalSection:=Decal--{button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=xHoQVN_F7JE&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_DecalEnabled,is_hideable:true}
+_DecalTexture:=Decal--{reference_properties:[_DecalTexturePan, _DecalTextureUV]}
+_DecalMask:=Mask--{reference_properties:[_DecalMaskPan, _DecalMaskUV]}
+
+// Details
+m_start_DetailOptions:=Details--{button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=9oIcQln9of4&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},is_hideable:true}
+_DetailMask:=Detail Mask--{reference_properties:[_DetailMaskPan, _DetailMaskUV]}
+_DetailTex:=Detail Texture--{reference_properties:[_DetailTexPan, _DetailTexUV]}
+_DetailNormalMap:=Detail Normal--{reference_properties:[_DetailNormalMapPan, _DetailNormalMapUV]}
+
+// Vertex Manipulation
+m_start_vertexManipulation:=Vertex Options--{button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=x728WN50JeA&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},is_hideable:true}
+// Alpha Options
+m_start_Alpha:=Alpha Options--{button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=kP4KFOd6P6o&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},is_hideable:true}
+
+// Backface
+m_start_backFace:=Back Face--{reference_property:_BackFaceEnabled,button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=uZnNpiCvsDg&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},is_hideable:true}
+_BackFaceEnabled:=Back Face--{hide_in_inspector:true}
+_BackFaceTexture:=Backface Texture--{reference_properties:[_BackFacePanning, _BackFaceTextureUV]}
+
+// Lighting
+m_lightingOptions:=Lighting & Reflections--{is_hideable:true,is_visible_simple:true}
+m_start_Lighting:=Light & Shadow--{reference_property:_EnableLighting,button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=TxVmCYkH8CM&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw&index=11&t=0s},hover:YouTube},is_hideable:true,is_visible_simple:true}
+_EnableLighting:=Light & Shadow--{hide_in_inspector:true}
+_LightingAOTex:=AO Map--{reference_properties:[_LightingAOTexPan, _LightingAOTexUV]}
+
+// Subsurface Scattering
+m_start_subsurface:=Subsurface Scattering--{reference_property:_EnableSSS,button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=WZ1fmFMVk0U&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},is_hideable:true}
+_EnableSSS:=Subsurface Scattering--{hide_in_inspector:true}
+_SSSThicknessMap:=Thickness Map--{reference_properties:[_SSSThicknessMapPan, _SSSThicknessMapUV]}
+
+_ToonRamp1:=Lighting Ramp 2--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true}
+_ToonRamp2:=Lighting Ramp 3--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true}
+_ToonRamp3:=Lighting Ramp 4--{texture:{width:512,height:4,filterMode:Bilinear,wrapMode:Clamp},force_texture_options:true}
+
+m_start_lightingStandard:=Standardish Settings
+
+m_start_lightingAdvanced:=Additive Lighting (Point & Spot Light)--{button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=at3p5yRRVU0&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw&index=12},hover:YouTube}}
+
+// Rim Lighting
+m_start_rimLightOptions:=Rim Lighting--{reference_property:_EnableRimLighting,button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=RE2eWlpdTm8&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},is_hideable:true}
+_EnableRimLighting:=Rim Lighting--{hide_in_inspector:true}
+_RimTex:=Rim Texture--{reference_properties:[_RimTexPan]}
+_RimTex:=Rim Texture--{reference_properties:[_RimTexPan, _RimTexUV]}
+_RimMask:=Rim Mask--{reference_properties:[_RimMaskPan, _RimMaskUV]}
+_RimWidthNoiseTexture:=Width Noise--{reference_properties:[_RimWidthNoiseTexturePan, _RimWidthNoiseTextureUV]}
+
+// Environmental Rim Lighting
+m_start_reflectionRim:=Environmental Rim Lighting--{button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=R1LTIjzk-WM&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},reference_property:_EnableEnvironmentalRim,is_hideable:true}
+_EnableEnvironmentalRim:=Environmental Rim Lighting--{hide_in_inspector:true}
+_RimEnviroMask:=Mask--{reference_properties:[_RimEnviroMaskPan, _RimEnviroMaskUV]}
+
+m_start_bakedLighting:=Baked Lighting--{is_hideable:true}
+
+// Reflections
+m_reflectionOptions:=Reflections--{is_hideable:true,is_visible_simple:true}
+// Metal
+m_start_Metallic:=Metallics--{reference_property:_EnableMetallic,button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=uSoj9eEFhPY&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},is_hideable:true,is_visible_simple:true}
+_EnableMetallic:=Metallics--{hide_in_inspector:true}
+_MetallicMask:=Metallic Map--{reference_properties:[_MetallicMaskPan, _MetallicMaskUV]}
+_MetallicTintMap:=RGB Tint A Mask--{reference_properties:[_MetallicTintMapPan, _MetallicTintMapUV]}
+_SmoothnessMask:=Smoothness Map--{reference_properties:[_SmoothnessMaskPan, _SmoothnessMaskUV]}
+
+// Clear Coat
+m_start_clearCoat:=Clear Coat--{reference_property:_EnableClearCoat,button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=HtbLCfgzFlg&list=PL4_Gy3VRJSmbXfQSldzUiChgABQsoBlLw},hover:YouTube},is_hideable:true}
+_EnableClearCoat:=Clear Coat--{hide_in_inspector:true}
+_ClearCoatMask:=Mask--{reference_properties:[_ClearCoatMaskPan, _ClearCoatMaskUV]}
+_ClearCoatSmoothnessMap:=Smoothness Map--{reference_properties:[_ClearCoatSmoothnessMapPan, _ClearCoatSmoothnessMapUV]}
+
+// Matcap
+m_start_matcap:=Matcap--{reference_property:_MatcapEnable,button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/DFo87kuO1OI},hover:YouTube},is_hideable:true,is_visible_simple:true}
+_MatcapEnable:=Matcap--{hide_in_inspector:true}
+_MatcapMask:=Mask--{reference_properties:[_MatcapMaskPan, _MatcapMaskUV]}
+m_start_Matcap2:=Matcap 2--{reference_property:_Matcap2Enable,button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/DFo87kuO1OI},hover:YouTube},is_hideable:true}
+_Matcap2Enable:=Matcap 2--{hide_in_inspector:true}
+_Matcap2Mask:=Mask--{reference_properties:[_Matcap2MaskPan, _Matcap2MaskUV]}
+
+// Specular
+m_start_specular:=Specular Reflections--{reference_property:_EnableSpecular,button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/YFFe8IrXVnc},hover:YouTube},is_hideable:true,is_visible_simple:true}
+_EnableSpecular:=Specular Reflections--{hide_in_inspector:true}
+_SpecularMap:=Spec Map--{reference_properties:[_SpecularMapPan, _SpecularMapUV]}
+_SpecularMask:=Spec Mask--{reference_properties:[_SpecularMaskPan, _SpecularMaskUV]}
+
+// Specular 2
+m_start_specular1:=Specular Reflections 2--{reference_property:_EnableSpecular1,button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/YFFe8IrXVnc},hover:YouTube},is_hideable:true}
+_EnableSpecular1:=Specular Reflections 2--{hide_in_inspector:true}
+_SpecularMap1:=Spec Map--{reference_properties:[_SpecularMap1Pan, _SpecularMap1UV]}
+_SpecularMask1:=Spec Mask--{reference_properties:[_SpecularMask1Pan, _SpecularMask1UV]}
+m_start_SpecularToon1:=Toon Specular
+m_start_Anisotropic1:=Anisotropic
+
+m_outlineOptions:=Outlines--{is_hideable:true}
+
+m_start_outlineAdvanced:=Advanced--{is_hideable:true,is_visible_simple:true}
+
+// Special Effects
+m_Special_Effects:=Special Effects--{is_hideable:true,is_visible_simple:true}
+
+// Emission
+m_emissionOptions:= Emission--{reference_property:_EnableEmission,button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/iqk23gtwkz0},hover:YouTube},is_hideable:true}
+m_start_emissionOptions:=Emission--{reference_property:_EnableEmission,button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/iqk23gtwkz0},hover:YouTube},is_hideable:true,is_visible_simple:true}
+_EnableEmission:=Emission--{hide_in_inspector:true}
+_EmissionMap:=Emission Map--{texture:{width:1224,height:4,filterMode:Bilinear,wrapMode:Repeat},reference_properties:[_EmissionMapPan, _EmissionMapUV], force_texture_options:true}
+_EmissionMask:=Emission Mask--{reference_properties:[_EmissionMaskPan, _EmissionMaskUV]}
+_EmissionMap1:=Emission Map--{texture:{width:1224,height:4,filterMode:Bilinear,wrapMode:Repeat},reference_properties:[_EmissionMap1Pan, _EmissionMap1UV], force_texture_options:true}
+_EmissionMask1:=Emission Mask--{reference_properties:[_EmissionMask1Pan, _EmissionMask1UV]}
+m_start_CenterOutEmission:=Center Out Emission
+m_start_glowInDarkEmissionOptions:=Glow In The Dark Emission (Requires Lighting Enabled)
+m_start_blinkingEmissionOptions:=Blinking Emission
+m_start_scrollingEmissionOptions:=Scrolling Emission
+
+m_start_emission1Options:=Emission 2(Requires Emission 1 Enabled)--{reference_property:_EnableEmission1,is_hideable:true}
+_EnableEmission1:=Emission 2(Requires Emission 1 Enabled)--{hide_in_inspector:true}
+m_start_CenterOutEmission1:=Center Out Emission
+m_start_glowInDarkEmissionOptions1:=Glow In The Dark Emission (Requires Lighting Enabled)
+m_start_blinkingEmissionOptions1:=Blinking Emission
+m_start_scrollingEmissionOptions1:=Scrolling Emission
+
+// Flipbook
+m_start_flipBook:=Flipbook--{reference_property:_EnableFlipbook,button_right:{reference_property:_EnableFlipbook,text:Tutorial,action:{type:URL,data:https://youtu.be/NrA18CITEVs},hover:YouTube},is_hideable:true}
+_EnableFlipbook:=Flipbook--{hide_in_inspector:true}
+m_start_manualFlipbookControl:=Manual Frame Control
+_FlipbookTexArray:=Texture Array--{reference_properties:[_FlipbookTexArrayPan, _FlipbookTexArrayUV]}
+_FlipbookMask:=Mask--{reference_properties:[_FlipbookMaskPan, _FlipbookMaskUV]}
+
+// Dissolve
+m_start_dissolve:=Dissolve--{reference_property:_EnableDissolve,button_right:{reference_property:_EnableDissolve,text:Tutorial,action:{type:URL,data:https://youtu.be/abTejmV4yGU},hover:YouTube},is_hideable:true}
+_EnableDissolve:=Dissolve--{hide_in_inspector:true}
+m_start_pointToPoint:=Point to Point
+_DissolveToTexture:=Dissolved Texture--{reference_properties:[_DissolveToTexturePan, _DissolveToTextureUV]}
+_DissolveNoiseTexture:=Dissolve Noise--{reference_properties:[_DissolveNoiseTexturePan, _DissolveNoiseTextureUV, _DissolveInvertNoise]}
+_DissolveDetailNoise:=Dissolve Detail Noise--{reference_properties:[_DissolveDetailNoisePan, _DissolveDetailNoiseUV, _DissolveInvertDetailNoise]}
+_DissolveMask:=Mask--{reference_properties:[_DissolveMaskPan, _DissolveMaskUV, _DissolveMaskInvert]}
+
+// Panosphere
+m_start_panosphereOptions:=Panosphere--{reference_property:_PanoToggle,button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/wyCY6qE0_Vg},hover:YouTube},is_hideable:true}
+_PanoToggle:=Panosphere--{hide_in_inspector:true}
+_PanoMask:=Mask--{reference_properties:[_PanoMaskPan, _PanoMaskUV]}
+
+// Glitter
+m_start_glitter:=Glitter--{reference_property:_GlitterEnable,is_hideable:true}
+_GlitterEnable:=Glitter--{hide_in_inspector:true}
+_GlitterColorMap:=Color Map--{reference_properties:[_GlitterColorMapPan, _GlitterColorMapUV]}
+_GlitterMask:=Mask--{reference_properties:[_GlitterMaskPan, _GlitterMaskUV]}
+
+// MSDF
+m_start_Text:=Text Overlay--{reference_property:_TextEnabled,is_hideable:true}
+_TextEnabled:=Text Overlay--{hide_in_inspector:true}
+m_start_TextFPS:=FPS--{reference_property:_TextFPSEnabled}
+_TextFPSEnabled:=FPS --{hide_in_inspector:true}
+m_start_TextPosition:=Position--{reference_property:_TextPositionEnabled}
+_TextPositionEnabled:=Position--{hide_in_inspector:true}
+m_start_TextInstanceTime:=Instance Time--{reference_property:_TextTimeEnabled}
+_TextTimeEnabled:=Instance Time--{hide_in_inspector:true}
+
+// Mirror Options
+m_start_mirrorOptions:=Mirror (VRChat)--{reference_property:_EnableMirrorOptions,button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/ptnVKyuijO4},hover:YouTube},is_hideable:true}
+_EnableMirrorOptions:=Mirror (VRChat)--{hide_in_inspector:true}
+_MirrorTexture:=Mirror Texture--{reference_properties:[_MirrorTexturePan, _MirrorTextureUV]}
+
+// Distance Fade
+m_start_distanceFade:=Distance Fade--{is_hideable:true}
+
+// Angular Fade
+m_start_angularFade:=Angular Fade--{reference_property:_EnableRandom,is_hideable:true}
+_EnableRandom:=Angular Fade--{hide_in_inspector:true}
+// Optimization
+m_optimization:=Optimization
+
+m_ParallaxMap:=Parallax--{reference_property:_ParallaxMap,is_hideable:true}
+_ParallaxMap:=Parallax--{hide_in_inspector:true}
+
+_ParallaxHeightMap:=Height Map--{reference_properties:[_ParallaxHeightMapPan]}
+
+m_start_parallaxHeightmap:=Heightmap--{reference_property:_ParallaxHeightMapEnabled}
+_ParallaxHeightMapEnabled:=Heightmap--{hide_in_inspector:true}
+
+m_start_parallaxInternal:=Internal Parallax--{reference_property:_ParallaxInternalMapEnabled}
+_ParallaxInternalMapEnabled:=Internal Parallax--{hide_in_inspector:true}
+
+_ParallaxHeightMapMask:=Mask--{reference_properties:[_ParallaxHeightMapMaskPan, _ParallaxHeightMapMaskUV]}
+_ParallaxInternalMapMask:=Mask--{reference_properties:[_ParallaxInternalMapMaskPan, _ParallaxInternalMapMaskUV]}
+
+m_start_parallaxAdvanced:=Advanced
+
+
+m_start_distortionFlow:=UV Distortion--{reference_property:_EnableDistortion,button_right:{text:Tutorial,action:{type:URL,data:https://www.youtube.com/watch?v=J17a3glPMYI&t=1s},hover:YouTube},is_hideable:true}
+_EnableDistortion:=UV Distortion--{hide_in_inspector:true}
+
+// Patreon
+m_Patreon:=Patreon--{is_hideable:true}
+
+// Video Settings
+m_start_Video:=Video--{reference_property:_EnableVideo,is_hideable:true}
+_EnableVideo:=Video--{hide_in_inspector:true}
+m_start_VideoSettings:=Video Texture Settings
+m_start_VideoDebug:=Video Debug
+m_start_CRT:=CRT Options
+m_start_Gameboy:=Gradient Options
+
+// Touch
+m_start_TouchOptions:=Touch FX--(Requires DepthGet Prefab,is_hideable:true)
+
+// Bulge
+m_start_Bulge:=Bulge--{reference_property:_EnableBulge,is_hideable:true}
+_EnableBulge:=Bulge --{hide_in_inspector:true}
+
+// Touch Glow
+m_start_TouchGlow:=Touch Color--{reference_property:_EnableTouchGlow, is_hideable:true}
+_EnableTouchGlow:=Touch Color --{hide_in_inspector:true}
+
+// Hologram
+m_start_Hologram:=Hologram Alpha--{reference_property:_EnableHolo, is_hideable:true}
+_EnableHolo:=Hologram Alpha--{hide_in_inspector:true}
+
+m_start_FresnelAlpha:=Fresnel Alpha
+_HoloAlphaMap:=Alpha Maptexture--{width:1024,height:4,filterMode:Bilinear,wrapMode:Repeat},force_texture_options:true}
+
+// m_start_GrabPass
+m_start_GrabPass:=Grab Pass--{is_hideable:true}
+
+// Refraction
+m_start_Refraction:=Refraction--{reference_property:_RefractionEnabled, is_hideable:true}
+_RefractionEnabled:=Refraction--{hide_in_inspector:true}
+
+// Blur
+m_start_Blur:=Blur--{reference_property:_EnableBlur, is_hideable:true}
+_EnableBlur:=Blur --{hide_in_inspector:true}
+
+// Vertex Glitching
+m_start_VertexGlitch:=Vertex Glitching--{reference_property:_EnableVertexGlitch, is_hideable:true}
+_EnableVertexGlitch:=Enable Glitching--{hide_in_inspector:true}
+
+// Iridescence
+m_start_Iridescence:=Iridescence--{reference_property:_EnableIridescence, is_hideable:true}
+_EnableIridescence:=Iridescence--{hide_in_inspector:true}
+
+// scifi spawn in
+m_start_ScifiSpawnIn:=Sci Fi--{reference_property:_EnableScifiSpawnIn, is_hideable:true}
+_EnableScifiSpawnIn:=Sci Fi --{hide_in_inspector:true}
+
+// Black Light
+m_start_BlackLight:=Black Light Mask--{reference_property:_BlackLightMaskEnabled, is_hideable:true}
+
+// Voronoi
+m_start_Voronoi:=Voronoi--{reference_property:_EnableVoronoi, is_hideable:true}
+_EnableVoronoi:=Voronoi--{hide_in_inspector:true}
+m_start_voronoiRandom:=Random Cell Color--{reference_property:_VoronoiEnableRandomCellColor}
+_VoronoiEnableRandomCellColor:=Random Cell Color--{hide_in_inspector:true}
+_VoronoiMask:=Mask--{reference_properties:[_VoronoiMaskPan, _VoronoiMaskUV]}
+_VoronoiNoise:=Edge Noise--{reference_properties:[_VoronoiNoisePan, _VoronoiNoiseUV]}
+
+m_renderingOptions:=Rendering Options--{button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/P5KlE9rk9pg},hover:YouTube}, is_hideable:true,is_visible_simple:true}
+m_start_StencilPassOptions:=Stencil--{button_right:{text:Tutorial,action:{type:URL,data:https://youtu.be/uniOEpw88jk},hover:YouTube}, is_hideable:true}
+m_start_OutlineStencil:=Outline Stencil--{is_hideable:true}
+
+m_start_debugOptions:=Debug--{reference_property:_DebugEnabled,is_hideable:true}
+
+m_animationToggles:=Animation Support Toggles--{is_hideable:true}
+
+// Footer
+footer_youtube:={texture:{name:icon-youtube,height:32},action:{type:URL,data:https://www.youtube.com/poiyomi},hover:YOUTUBE}
+footer_twitter:={texture:{name:icon-twitter,height:32},action:{type:URL,data:https://twitter.com/poiyomi},hover:TWITTER}
+footer_patreon:={texture:{name:icon-patreon,height:32},action:{type:URL,data:https://www.patreon.com/poiyomi},hover:PATREON}
+footer_discord:={texture:{name:icon-discord,height:32},action:{type:URL,data:https://discord.gg/Ays52PY},hover:DISCORD}
+footer_github:={texture:{name:icon-github,height:32},action:{type:URL,data:https://github.com/poiyomi/PoiyomiToonShader},hover:GITHUB} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/PoiLabels.txt.meta b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/PoiLabels.txt.meta
new file mode 100755
index 00000000..ed4cafc8
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/_PoiyomiShaders/Shaders/PoiLabels.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 0a61a58ee74a4074e96d62e63f4e3354
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant: